HtmlHelperDisplayExtensions Class

Display-related extensions for Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper and Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper`1.

Namespace
Microsoft.AspNetCore.Mvc.Rendering
Assemblies
  • Microsoft.AspNetCore.Mvc.ViewFeatures

Syntax

public class HtmlHelperDisplayExtensions
class Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperDisplayExtensions

Methods

Display(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String)

Returns HTML markup for the <em>expression</em>, using a display template. The template is found using the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression)
Display(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Object)

Returns HTML markup for the <em>expression</em>, using a display template and specified additional view data. The template is found using the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression, object additionalViewData)
Display(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String)

Returns HTML markup for the <em>expression</em>, using a display template. The template is found using the <em>templateName</em> or the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression, string templateName)
Display(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object)

Returns HTML markup for the <em>expression</em>, using a display template and specified additional view data. The template is found using the <em>templateName</em> or the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression, string templateName, object additionalViewData)
Display(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.String)

Returns HTML markup for the <em>expression</em>, using a display template and specified HTML field name. The template is found using the <em>templateName</em> or the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
  • htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.
  • expression (System.String) – Expression name, relative to the current model. May identify a single property or an System.Object that contains the properties to display.
  • templateName (System.String) – The name of the template used to create the HTML markup.
  • htmlFieldName (System.String) – A System.String used to disambiguate the names of HTML elements that are created for properties that have the same name.
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression, string templateName, string htmlFieldName)
DisplayForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper)

Returns HTML markup for the current model, using a display template. The template is found using the model’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper instance this method extends.
Return type:Microsoft.AspNetCore.Html.IHtmlContent
Returns:A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.
public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper)
DisplayForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.Object)

Returns HTML markup for the current model, using a display template and specified additional view data. The template is found using the model’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, object additionalViewData)
DisplayForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String)

Returns HTML markup for the current model, using a display template. The template is found using the <em>templateName</em> or the model’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName)
DisplayForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Object)

Returns HTML markup for the current model, using a display template and specified additional view data. The template is found using the <em>templateName</em> or the model’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName, object additionalViewData)
DisplayForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String)

Returns HTML markup for the current model, using a display template and specified HTML field name. The template is found using the <em>templateName</em> or the model’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName, string htmlFieldName)
DisplayForModel(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object)

Returns HTML markup for the current model, using a display template, specified HTML field name, and additional view data. The template is found using the <em>templateName</em> or the model’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName, string htmlFieldName, object additionalViewData)
DisplayFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)

Returns HTML markup for the <em>expression</em>, using a display template. The template is found using the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression)
DisplayFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object)

Returns HTML markup for the <em>expression</em>, using a display template and specified additional view data. The template is found using the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, object additionalViewData)
DisplayFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String)

Returns HTML markup for the <em>expression</em>, using a display template. The template is found using the <em>templateName</em> or the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string templateName)
DisplayFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object)

Returns HTML markup for the <em>expression</em>, using a display template and specified additional view data. The template is found using the <em>templateName</em> or the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string templateName, object additionalViewData)
DisplayFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.String)

Returns HTML markup for the <em>expression</em>, using a display template and specified HTML field name. The template is found using the <em>templateName</em> or the <em>expression</em>’s Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.

Arguments:
  • htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper`1 instance this method extends.
  • expression (System.Linq.Expressions.Expression<System.Func<TModel, TResult>>) – An expression to be evaluated against the current model.
  • templateName (System.String) – The name of the template used to create the HTML markup.
  • htmlFieldName (System.String) – A System.String used to disambiguate the names of HTML elements that are created for properties that have the same name.
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the created HTML.

public static IHtmlContent DisplayFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string templateName, string htmlFieldName)