public static HtmlTag CheckBoxBuilder(ElementRequest request) { var isChecked = request.Value<bool>(); var tag = new CheckboxTag(isChecked); tag.Attr("name", request.Accessor.Name); tag.AddClass("checkbox"); return tag; }
public MvcCheckboxElement(string id, string name, bool isChecked) : base("") { NoTag(); Tag = new CheckboxTag(isChecked); Tag.Id(id).Name(name); if (isChecked) { Tag .Attr("checked", "checked") ; } Tag.Value("true"); Append(Tag); Append(new HiddenTag().Name(name).Value("false")); }