Tuesday, September 8, 2009

Code: ASP.Net MVC Maintain Checkbox State

Below is a quick and dirty way to maintain a check box checked state during postbacks with MVC:

<%= Html.CheckBox("IsSecure", (Request.Form["IsSecure"] ?? string.Empty).Contains("true"))%>