I'm using the below given table in Partial view and I want to set the value of checkboxes to true by default using Html Helper. I have tried
<input type="checkbox" value="@Model[i].IsSelected" checked="checked" />
but it passes the false value to controller even if I checked it to true. Here is my table code. .
@model List<SchoolManagment.Models.tbl_Student>
<table id="tableforposting" class="table table-hover table-bordered">
<thead>
<tr>
<th>Sr#</th>
<th class="col-sm-1"></th>
<th>STUDENT NAME</th>
<th>ROLL NO.</th>
</tr>
</thead>
<tbody>
@for (int i = 0; i < Model.Count(); i++)
{
<tr>
<td class="col-sm-1 text-center">
@Html.CheckBoxFor(x => x[i].IsSelected)
</td>
<td>
@Html.DisplayFor(x => x[i].Name)
</td>
<td>
@Html.DisplayFor(x => x[i].Roll_No)
@Html.HiddenFor(x => x[i].Roll_No)
</td>
</tr>
}
</tbody>
</table>