How can I make Html.CheckBoxFor() work on a string field?
问题 I'm using ASP.NET MVC3 with Razor and C#. I am making a form builder of sorts, so I have a model that has a collection of the following object: public class MyFormField { public string Name { get; set; } public string Value { get; set; } public MyFormType Type { get; set; } } MyFormType is just an enum that tells me if the form field is a checkbox, or textbox, or file upload, or whatever. My editor template looks something like this (see the comment): ~/Views/EditorTemplates/MyFormField