While working on a project in C# 3.5 using ASP.NET MVC, I have a challenge where I cannot use a strongly-typed view. I noticed the checkbox is coded as
1 | <%= Html.CheckBox("HoldFlag", Model.HoldFlag) %> |
However, calling form["HoldFlag"] was behaving oddly. When the box was checked, it was returned as “true, false” but when unchecked it was “false”. So I guess for now I’m going to handle it as follows:
1 | var hold = form["HoldFlag"].Contains("true"); |