internal static MvcHtmlString DisplayNameInternal(this HtmlHelper html, string expression, ModelMetadataProvider metadataProvider)
 {
     return(DisplayNameHelper(ModelMetadata.FromStringExpression(expression, html.ViewData),
                              expression));
 }
        public HtmlHelper(ViewContext viewContext, IViewDataContainer viewDataContainer, RouteCollection routeCollection)
        {
            if (viewContext == null)
            {
                throw new ArgumentNullException("viewContext");
            }
            if (viewDataContainer == null)
            {
                throw new ArgumentNullException("viewDataContainer");
            }
            if (routeCollection == null)
            {
                throw new ArgumentNullException("routeCollection");
            }

            ViewContext                 = viewContext;
            ViewDataContainer           = viewDataContainer;
            RouteCollection             = routeCollection;
            ClientValidationRuleFactory = (name, metadata) => ModelValidatorProviders.Providers.GetValidators(metadata ?? ModelMetadata.FromStringExpression(name, ViewData), ViewContext).SelectMany(v => v.GetClientValidationRules());
        }
 public static MvcHtmlString RequiredLabel(this HtmlHelper html, string expression, string id = "", bool generatedId = false)
 {
     return(LabelHelper(html,
                        ModelMetadata.FromStringExpression(expression, html.ViewData),
                        expression, id, generatedId));
 }
Ejemplo n.º 4
0
 public static MvcHtmlString FormItemLabel(this HtmlHelper html, string expression, string labelText)
 {
     return(FormItemLabel(html, ModelMetadata.FromStringExpression(expression, html.ViewData), expression, labelText));
 }