I am new to asp.net mvc. I am making an online video store application.
I have this view:
where users can choose which videos their gonna rent. The cod
you may want to build a view model
public class YourDBContext
{
public int Id { get; set; }
public string Name { get; set; }
}
public class YourDBContextView
{
public int Id { get; set; }
public string Name { get; set; }
public bool IsSelected { get; set; }
}
and use @using (Html.BeginForm()) on the view
[HttpPost]
public ActionResult Index(IEnumerable obj)
{
//You can get your checkbox here
foreach(YourDBContextView view in obj)
{
bool test = view.IsSelected;
}
}