ExtensionCheckBoxToBool Method |  |
Convert Html.CheckBox and Html.CheckBoxFor return value (web form values) to boolean
Namespace:
Velo.Web.Helper
Assembly:
Velo.Web (in Velo.Web.dll) Version: 22.2.10.1 (22.2.10.450)
Syntaxpublic static bool CheckBoxToBool(
this string pValue
)
<ExtensionAttribute>
Public Shared Function CheckBoxToBool (
pValue As String
) As Boolean
Parameters
- pValue
- Type: SystemString
Value convert to boolean
Return Value
Type:
Booleantrue = checked; false = unchecked
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
String. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks Checked handling in input "false" für unchecked; "true, false" für checked
Example:
@Html.CheckBox(item.RoleName, item.IsSelected) Helper rendering:
<input id="Instruktor" name="Instruktor" type="checkbox" value="true" /><input name="Instruktor" type="hidden" value="false" />
See Also