Search code examples
asp.net-mvccheckboxfor

Checking if a checkbox has been checked in .net mvc


I have a strongly typed ViewModel which contains check boxes.

When I am processing in my Controller for an update, I need to find out whether the item has been checked or not.

How do I go about doing that???


Solution

  • [HttpPost]    
    public ActionResult Update(MyViewModel viewModel)
    {
        var isChecked = viewModel.ThePropertyUsedWithYourCheckBoxFor;
    }
    

    Or, am I missing something?