using System; using System.Linq.Expressions; using System.Web; using System.Web.Mvc; using System.Web.Mvc.Html; using System.Web.Routing; namespace EnVisage.Code.HtmlHelpers { public static class HtmlExtensions { public static IHtmlString TextBoxFor(this HtmlHelper htmlHelper, Expression> expression, object htmlAttributes, bool disabled) { var attributes = new RouteValueDictionary(htmlAttributes); if (disabled) { attributes["disabled"] = "disabled"; } return htmlHelper.TextBoxFor(expression, attributes); } public static MvcHtmlString RadioButtonFor(this HtmlHelper htmlHelper, Expression> expression, bool value, object htmlAttributes, bool disabled) { var attributes = new RouteValueDictionary(htmlAttributes); if (disabled) { attributes["disabled"] = "disabled"; } return htmlHelper.RadioButtonFor(expression, value, attributes); } } }