public static MvcHtmlString TextBoxSIR(this HtmlHelper htmlHelper, string name, string value, string format, object htmlAttributes, SIRDatatype sirdt = SIRDatatype.Default) { RouteValueDictionary routeValues = new RouteValueDictionary(htmlAttributes); switch (sirdt) { case SIRDatatype.CodigoPostal: routeValues.Add("style", "max-width:25%;"); break; case SIRDatatype.Telemovel: routeValues.Add("style", "max-width:9em;"); break; case SIRDatatype.NICP: routeValues.Add("style", "max-width:10em;"); break; case SIRDatatype.NIC: routeValues.Add("style", "max-width:75%;"); break; case SIRDatatype.CIN: routeValues.Add("style", "max-width:70px;"); break; } return(System.Web.Mvc.Html.InputExtensions.TextBox(htmlHelper, name, value, format, routeValues)); }
public static MvcHtmlString TextBoxSIRFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TValue> > expression, object htmlAttributes, SIRDatatype sirdt = SIRDatatype.Default) { RouteValueDictionary routeValues = new RouteValueDictionary(htmlAttributes); switch (sirdt) { case SIRDatatype.CodigoPostal: routeValues.Add("style", "max-width:25%;"); break; case SIRDatatype.Telemovel: routeValues.Add("style", "max-width:9em;"); break; case SIRDatatype.NICP: routeValues.Add("style", "max-width:10em;"); break; case SIRDatatype.NIC: routeValues.Add("style", "max-width:75%;"); break; case SIRDatatype.CIN: routeValues.Add("style", "max-width:70px;"); break; } return(System.Web.Mvc.Html.InputExtensions.TextBoxFor(htmlHelper, expression, routeValues)); }