HtmlHelperDisplayExtensions.DisplayFor Method

Definition

Overloads

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>)

Returns HTML markup for the expression, using a display template. The template is found using the expression's ModelMetadata.

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, Object)

Returns HTML markup for the expression, using a display template and specified additional view data. The template is found using the expression's ModelMetadata.

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String)

Returns HTML markup for the expression, using a display template. The template is found using the templateName or the expression's ModelMetadata.

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, Object)

Returns HTML markup for the expression, using a display template and specified additional view data. The template is found using the templateName or the expression's ModelMetadata.

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, String)

Returns HTML markup for the expression, using a display template and specified HTML field name. The template is found using the templateName or the expression's ModelMetadata.

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>)

Source:
HtmlHelperDisplayExtensions.cs
Source:
HtmlHelperDisplayExtensions.cs

Returns HTML markup for the expression, using a display template. The template is found using the expression's ModelMetadata.

public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ DisplayFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression);
public static Microsoft.AspNetCore.Html.IHtmlContent DisplayFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression);
static member DisplayFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function DisplayFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult))) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

Returns

A new IHtmlContent containing the created HTML.

Remarks

For example the default Object display template includes markup for each property in the expression result.

Custom templates are found under a DisplayTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

Applies to

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, Object)

Source:
HtmlHelperDisplayExtensions.cs
Source:
HtmlHelperDisplayExtensions.cs

Returns HTML markup for the expression, using a display template and specified additional view data. The template is found using the expression's ModelMetadata.

public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ DisplayFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::Object ^ additionalViewData);
public static Microsoft.AspNetCore.Html.IHtmlContent DisplayFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, object additionalViewData);
static member DisplayFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function DisplayFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult)), additionalViewData As Object) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

additionalViewData
Object

An anonymous Object or IDictionary<TKey,TValue> that can contain additional view data that will be merged into the ViewDataDictionary<TModel> instance created for the template.

Returns

A new IHtmlContent containing the created HTML.

Remarks

For example the default Object display template includes markup for each property in the expression result.

Custom templates are found under a DisplayTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

Applies to

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String)

Source:
HtmlHelperDisplayExtensions.cs
Source:
HtmlHelperDisplayExtensions.cs

Returns HTML markup for the expression, using a display template. The template is found using the templateName or the expression's ModelMetadata.

public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ DisplayFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ templateName);
public static Microsoft.AspNetCore.Html.IHtmlContent DisplayFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string templateName);
static member DisplayFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function DisplayFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult)), templateName As String) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

templateName
String

The name of the template used to create the HTML markup.

Returns

A new IHtmlContent containing the created HTML.

Remarks

For example the default Object display template includes markup for each property in the expression result.

Custom templates are found under a DisplayTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

Applies to

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, Object)

Source:
HtmlHelperDisplayExtensions.cs
Source:
HtmlHelperDisplayExtensions.cs

Returns HTML markup for the expression, using a display template and specified additional view data. The template is found using the templateName or the expression's ModelMetadata.

public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ DisplayFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ templateName, System::Object ^ additionalViewData);
public static Microsoft.AspNetCore.Html.IHtmlContent DisplayFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string templateName, object additionalViewData);
static member DisplayFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function DisplayFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult)), templateName As String, additionalViewData As Object) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

templateName
String

The name of the template used to create the HTML markup.

additionalViewData
Object

An anonymous Object or IDictionary<TKey,TValue> that can contain additional view data that will be merged into the ViewDataDictionary<TModel> instance created for the template.

Returns

A new IHtmlContent containing the created HTML.

Remarks

For example the default Object display template includes markup for each property in the expression result.

Custom templates are found under a DisplayTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

Applies to

DisplayFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, String)

Source:
HtmlHelperDisplayExtensions.cs
Source:
HtmlHelperDisplayExtensions.cs

Returns HTML markup for the expression, using a display template and specified HTML field name. The template is found using the templateName or the expression's ModelMetadata.

public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ DisplayFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ templateName, System::String ^ htmlFieldName);
public static Microsoft.AspNetCore.Html.IHtmlContent DisplayFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string templateName, string htmlFieldName);
static member DisplayFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function DisplayFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult)), templateName As String, htmlFieldName As String) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

templateName
String

The name of the template used to create the HTML markup.

htmlFieldName
String

A String used to disambiguate the names of HTML elements that are created for properties that have the same name.

Returns

A new IHtmlContent containing the created HTML.

Remarks

For example the default Object display template includes markup for each property in the expression result.

Custom templates are found under a DisplayTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

Applies to