How to make disable or readonly if FlagAccessEdit =false?
public static MvcHtmlString CCheckBox(this HtmlHelper htmlHelper,
string name,object htmlAttributes,
bool FlagAccessEdit = true, bool FlagAccessView = true)
{
if (!FlagAccessView)
return MvcHtmlString.Empty;
else if (!FlagAccessEdit && FlagAccessView)
{
return htmlHelper.CheckBox(name, htmlAttributes);
}
else
return htmlHelper.CheckBox(name, htmlAttributes);
}
falseeven if the checkbox is initially displayed as checked (true) which would no doubt screw up your app. If you want to do this, generate a hidden input for the value a some text (say "Yes" or "No") - user3559349