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: - 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.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - 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. - additionalViewData (System.Object) – An anonymous
System.Object
orSystem.Collections.Generic.IDictionary`2
that can contain additional view data that will be merged into theMicrosoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1
instance created for the template.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression, object additionalViewData)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - 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.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression, string templateName)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - 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.
- additionalViewData (System.Object) – An anonymous
System.Object
orSystem.Collections.Generic.IDictionary`2
that can contain additional view data that will be merged into theMicrosoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1
instance created for the template.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression, string templateName, object additionalViewData)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression, string templateName, string htmlFieldName)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - additionalViewData (System.Object) – An anonymous
System.Object
orSystem.Collections.Generic.IDictionary`2
that can contain additional view data that will be merged into theMicrosoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1
instance created for the template.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, object additionalViewData)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - templateName (System.String) – The name of the template used to create the HTML markup.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - templateName (System.String) – The name of the template used to create the HTML markup.
- additionalViewData (System.Object) – An anonymous
System.Object
orSystem.Collections.Generic.IDictionary`2
that can contain additional view data that will be merged into theMicrosoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1
instance created for the template.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName, object additionalViewData)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - 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: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName, string htmlFieldName)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
instance this method extends. - 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. - additionalViewData (System.Object) – An anonymous
System.Object
orSystem.Collections.Generic.IDictionary`2
that can contain additional view data that will be merged into theMicrosoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1
instance created for the template.
Return type: Returns: A new
Microsoft.AspNetCore.Html.IHtmlContent
containing the created HTML.public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName, string htmlFieldName, object additionalViewData)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper) – The
-
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: - 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.
Return type: 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)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The
-
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: - 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.
- additionalViewData (System.Object) – An anonymous
System.Object
orSystem.Collections.Generic.IDictionary`2
that can contain additional view data that will be merged into theMicrosoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1
instance created for the template.
Return type: 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)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The
-
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: - 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.
Return type: 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)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The
-
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: - 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.
- additionalViewData (System.Object) – An anonymous
System.Object
orSystem.Collections.Generic.IDictionary`2
that can contain additional view data that will be merged into theMicrosoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1
instance created for the template.
Return type: 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)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The
-
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: 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)
- htmlHelper (Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>) – The
-