ListCheckBox

Tag Helper <list-checkbox />

Creates a list of checkboxes which can be selected and the values all applied to the one field.

string name

The HTML id and name attribute used.

List<string> list

The list of options or checkboxes with their labels. This is also the value of the checkbox.

List<string> items

The list of values in any order that match the list of checkbox values to flag as checked.

string labelClass
Default: "form-check-label"

The CSS class to add to each label.

bool readOnly
Default: false

Make the control read only.

Example

Razor
@{
var items = Model.ModelGet();
int row = 0;
}
 
<table shareit-grid="true" id="MyTable" share-it-grid-model="@Model" add-button="@false" action="/" row-id-name="MyTableRowId">
<tbody>
@foreach (var m in items)
{
<tr row-id="@m.MyTableRowId">
<td header-text="Select" no-sort="@true" class="text-center"><list-checkbox name="myFieldIds" row-num="@(row++)" value="@m.MyFieldId" /></td>
<list-checkbox name="myFieldIds" row-num="@(row++)" value="@m.MyFieldId" />
</td>
</tr>
}
</tbody>
</table>