DisplayTextExtensions.DisplayTextFor<TModel, TResult> Method

Returns HTML markup for each property in the object that is represented by the specified expression.

Namespace:  System.Web.Mvc.Html
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function DisplayTextFor(Of TModel, TResult) ( _
    html As HtmlHelper(Of TModel), _
    expression As Expression(Of Func(Of TModel, TResult)) _
) As MvcHtmlString
public static MvcHtmlString DisplayTextFor<TModel, TResult>(
    this HtmlHelper<TModel> html,
    Expression<Func<TModel, TResult>> expression
)
[ExtensionAttribute]
public:
generic<typename TModel, typename TResult>
static MvcHtmlString^ DisplayTextFor(
    HtmlHelper<TModel>^ html, 
    Expression<Func<TModel, TResult>^>^ expression
)

Type Parameters

  • TModel
    The type of the model.
  • TResult
    The type of the value.

Parameters

Return Value

Type: System.Web.Mvc.MvcHtmlString
The HTML markup for each property in the object that is represented by the expression.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HtmlHelper<TModel>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

DisplayTextExtensions Class

System.Web.Mvc.Html Namespace