internal static MvcHtmlString DisplayNameForInternal <TModel, TValue>(this HtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression, ModelMetadataProvider metadataProvider) { return(DisplayNameHelper(ModelMetadata.FromLambdaExpression(expression, html.ViewData), ExpressionHelper.GetExpressionText(expression))); }
public static MvcHtmlString DisplayNameForSingleModelItem <TModel, TValue>(this HtmlHelper <IEnumerable <TModel> > html, Expression <Func <TModel, TValue> > expression) { return(DisplayNameForInternal(html, expression, metadataProvider: null)); }
internal static MvcHtmlString DisplayNameInternal(this HtmlHelper html, string expression, ModelMetadataProvider metadataProvider) { return(DisplayNameHelper(ModelMetadata.FromStringExpression(expression, html.ViewData), expression)); }
//[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", Justification = "This is an extension method")] internal static MvcHtmlString DisplayNameForInternal <TModel, TValue>(this HtmlHelper <IEnumerable <TModel> > html, Expression <Func <TModel, TValue> > expression, ModelMetadataProvider metadataProvider) { return(DisplayNameHelper(ModelMetadata.FromLambdaExpression(expression, new ViewDataDictionary <TModel>()), ExpressionHelper.GetExpressionText(expression))); }
public static MvcHtmlString DisplayForModel(this HtmlHelper html, string templateName, object additionalViewData) { return(MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, templateName, DataBoundControlMode.ReadOnly, additionalViewData))); }
public static MvcHtmlString DisplayForModel(this HtmlHelper html, string templateName, string htmlFieldName) { return(MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, htmlFieldName, templateName, DataBoundControlMode.ReadOnly, null /* additionalViewData */))); }
public static MvcHtmlString DisplayFor <TModel, TValue>(this HtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression, string templateName, string htmlFieldName, object additionalViewData) { return(TemplateHelpers.TemplateFor(html, expression, templateName, htmlFieldName, DataBoundControlMode.ReadOnly, additionalViewData)); }
public static MvcHtmlString DisplayFor <TModel, TValue>(this HtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression) { return(TemplateHelpers.TemplateFor(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.ReadOnly, null /* additionalViewData */)); }
public static MvcHtmlString Display(this HtmlHelper html, string expression, string templateName, string htmlFieldName, object additionalViewData) { return(TemplateHelpers.Template(html, expression, templateName, htmlFieldName, DataBoundControlMode.ReadOnly, additionalViewData)); }
public static MvcHtmlString Display(this HtmlHelper html, string expression, string templateName) { return(TemplateHelpers.Template(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.ReadOnly, null /* additionalViewData */)); }
public static MvcHtmlString Link(this HtmlHelper self, string linkText, PotentialUrl location, object htmlAttributes = null) { var uri = PathHelpers.GenerateClientUrl(self.ViewContext.HttpContext, "~" + location.ToString()); if (String.IsNullOrEmpty(linkText)) { throw new ArgumentException("Link text not allowed to be null or empty", "linkText"); } var tagBuilder = new TagBuilder("a") { InnerHtml = (!String.IsNullOrEmpty(linkText)) ? HttpUtility.HtmlEncode(linkText) : String.Empty }; if (htmlAttributes != null) { var attributeDictionary = (htmlAttributes as IDictionary <string, object>) ?? HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); tagBuilder.MergeAttributes(attributeDictionary); } tagBuilder.MergeAttribute("href", uri); var linkString = tagBuilder.ToString(TagRenderMode.Normal); return(MvcHtmlString.Create(linkString)); }