how to Convert webgrid data with checkbox to json in mvc?
here is my webgrid
<div class="portlet-body">
<div class="task-content">
<div id="gridContent">
<div class="table-responsive">
@grid.GetHtml(tableStyle: "webGrid",
headerStyle: "header",
htmlAttributes: new { id = "subAssign" },
alternatingRowStyle: "alt",
mode: WebGridPagerModes.All,
firstText: "<< First",
previousText: "< Prev",
nextText: "Next >",
lastText: "Last >>",
columns: grid.Columns(
grid.Column(header: "Sr.No",
format: item => item.WebGrid.Rows.IndexOf(item) + 1 + Math.Round(Convert.ToDouble(grid.TotalRowCount / grid.PageCount) / grid.RowsPerPage) * grid.RowsPerPage * grid.PageIndex),
grid.Column("SubjectCode", "Subject Code"),
grid.Column("SubjectName", " Subject Name"),
grid.Column(columnName: "IsTheory", header: "Theory", canSort: false,
format: (item) => @Html.Raw("<input type='checkbox' ((Convert.ToInt32(item.IsTheory) == 1) ? "checked" : "") />")),
grid.Column(columnName: "IsPractical", header: "Practical", canSort: false,
format: (item) => @Html.Raw("<input type='checkbox' ((Convert.ToInt32(item.IsPractical) == 1) ? "checked" : "") />"))
))
</div>
</div>
</div>
</div>
What I have tried:
All the data of webgrid is converting to json format except checkbox value is constant "True" even for unchecked box.