HtmlHelperDisplayExtensions Class¶
Summary¶
Display-related extensions for [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) and [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml).
Methods¶
-
Display
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String)¶ Returns HTML markup for the <paramref name=”expression” />, using a display template. The template is found using the <paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) 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: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString Display(IHtmlHelper htmlHelper, string expression)
-
Display
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.Object) Returns HTML markup for the <paramref name=”expression” />, using a display template and specified additional view data. The template is found using the <paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) 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]() or [System.Collections.Generic.IDictionary`2]() that can contain additional view data that will be merged into the [Microsoft.AspNet.Mvc.ViewDataDictionary`1](Microsoft.AspNet.Mvc.ViewDataDictionary`1.yml) instance created for the template.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString Display(IHtmlHelper htmlHelper, string expression, object additionalViewData)
-
Display
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String) Returns HTML markup for the <paramref name=”expression” />, using a display template. The template is found using the <paramref name=”templateName” /> or the <paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) 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: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString Display(IHtmlHelper htmlHelper, string expression, string templateName)
-
Display
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object) Returns HTML markup for the <paramref name=”expression” />, using a display template and specified additional view data. The template is found using the <paramref name=”templateName” /> or the
<paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) 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]() or [System.Collections.Generic.IDictionary`2]() that can contain additional view data that will be merged into the [Microsoft.AspNet.Mvc.ViewDataDictionary`1](Microsoft.AspNet.Mvc.ViewDataDictionary`1.yml) instance created for the template.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString Display(IHtmlHelper htmlHelper, string expression, string templateName, object additionalViewData)
-
Display
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.String) Returns HTML markup for the <paramref name=”expression” />, using a display template and specified HTML field name. The template is found using the <paramref name=”templateName” /> or the
<paramref name=”expression” />’s[Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) 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.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString Display(IHtmlHelper htmlHelper, string expression, string templateName, string htmlFieldName)
-
DisplayForModel
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper)¶ Returns HTML markup for the current model, using a display template. The template is found using the model’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayForModel(IHtmlHelper htmlHelper)
-
DisplayForModel
(Microsoft.AspNet.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.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- additionalViewData (System.Object) – An anonymous [System.Object]() or [System.Collections.Generic.IDictionary`2]() that can contain additional view data that will be merged into the [Microsoft.AspNet.Mvc.ViewDataDictionary`1](Microsoft.AspNet.Mvc.ViewDataDictionary`1.yml) instance created for the template.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayForModel(IHtmlHelper htmlHelper, object additionalViewData)
-
DisplayForModel
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String) Returns HTML markup for the current model, using a display template. The template is found using the
<paramref name=”templateName” /> or the model’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- templateName (System.String) – The name of the template used to create the HTML markup.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayForModel(IHtmlHelper htmlHelper, string templateName)
-
DisplayForModel
(Microsoft.AspNet.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 <paramref name=”templateName” /> or the model’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) 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]() or [System.Collections.Generic.IDictionary`2]() that can contain additional view data that will be merged into the [Microsoft.AspNet.Mvc.ViewDataDictionary`1](Microsoft.AspNet.Mvc.ViewDataDictionary`1.yml) instance created for the template.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayForModel(IHtmlHelper htmlHelper, string templateName, object additionalViewData)
-
DisplayForModel
(Microsoft.AspNet.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 <paramref name=”templateName” /> or the model’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) 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: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayForModel(IHtmlHelper htmlHelper, string templateName, string htmlFieldName)
-
DisplayForModel
(Microsoft.AspNet.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 <paramref name=”templateName” /> or the model’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) 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]() or [System.Collections.Generic.IDictionary`2]() that can contain additional view data that will be merged into the [Microsoft.AspNet.Mvc.ViewDataDictionary`1](Microsoft.AspNet.Mvc.ViewDataDictionary`1.yml) instance created for the template.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayForModel(IHtmlHelper htmlHelper, string templateName, string htmlFieldName, object additionalViewData)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperDisplayExtensions.DisplayFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Returns HTML markup for the <paramref name=”expression” />, using a display template. The template is found using the <paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) instance this method extends.
- expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) – An expression to be evaluated against the current model.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperDisplayExtensions.DisplayFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object)
Returns HTML markup for the <paramref name=”expression” />, using a display template and specified additional view data. The template is found using the <paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) 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]() or [System.Collections.Generic.IDictionary`2]() that can contain additional view data that will be merged into the [Microsoft.AspNet.Mvc.ViewDataDictionary`1](Microsoft.AspNet.Mvc.ViewDataDictionary`1.yml) instance created for the template.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, object additionalViewData)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperDisplayExtensions.DisplayFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String)
Returns HTML markup for the <paramref name=”expression” />, using a display template. The template is found using the <paramref name=”templateName” /> or the <paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) 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: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string templateName)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperDisplayExtensions.DisplayFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object)
Returns HTML markup for the <paramref name=”expression” />, using a display template and specified additional view data. The template is found using the <paramref name=”templateName” /> or the
<paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) 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]() or [System.Collections.Generic.IDictionary`2]() that can contain additional view data that will be merged into the [Microsoft.AspNet.Mvc.ViewDataDictionary`1](Microsoft.AspNet.Mvc.ViewDataDictionary`1.yml) instance created for the template.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string templateName, object additionalViewData)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperDisplayExtensions.DisplayFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.String)
Returns HTML markup for the <paramref name=”expression” />, using a display template and specified HTML field name. The template is found using the <paramref name=”templateName” /> or the
<paramref name=”expression” />’s [Microsoft.AspNet.Mvc.ModelBinding.ModelMetadata]().
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) 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.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the created HTML.
public static HtmlString DisplayFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string templateName, string htmlFieldName)
-