Sagar Bandkar

Sagar Bandkar

  • 1.4k
  • 347
  • 48.9k

Get Checkbox value from view to controller

Dec 6 2016 4:53 AM
I Pass ID as name for checkbox in Grid.MVC ? How to get value of selected Id in controller
But i got null value from controller 
 
@Html.Grid(Model).Named("Grid").Columns(columns =>
{
columns.Add()
.Titled("<input name='allChk' type='checkbox' id='checkbox1' />")
.Encoded(false)
.Sanitized(false)
.SetWidth(30)
.RenderValueAs(c => Html.CheckBox("checked",false, new { @class = "checkBox",name= "inCosId", @[email protected],ID=c.inCosId })).SetWidth(100);
columns.Add(c => c.vcCosCode).Titled("Cost Center Code").Filterable(true);
}).WithMultipleFilters()
 
 
controller:-
var ch = form.GetValue("inCosId");
if (ch != null)
{
}
return View();
 

Answers (3)