HtmlHelper<TModel> Class

Inheritance Hierarchy

Syntax

public class HtmlHelper<TModel> : HtmlHelper, ICanHasViewContext, IHtmlHelper<TModel>, IHtmlHelper

GitHub

View on GitHub

Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>

Constructors

HtmlHelper(Microsoft.AspNet.Mvc.Rendering.IHtmlGenerator, Microsoft.AspNet.Mvc.Rendering.ICompositeViewEngine, Microsoft.AspNet.Mvc.ModelBinding.IModelMetadataProvider, IHtmlEncoder, IUrlEncoder, IJavaScriptStringEncoder)

Initializes a new instance of the [Microsoft.AspNet.Mvc.Rendering.HtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.HtmlHelper`1.yml) class.

Arguments:
public HtmlHelper(IHtmlGenerator htmlGenerator, ICompositeViewEngine viewEngine, IModelMetadataProvider metadataProvider, IHtmlEncoder htmlEncoder, IUrlEncoder urlEncoder, IJavaScriptStringEncoder javaScriptStringEncoder)

Properties

ViewData()
Return type:Microsoft.AspNet.Mvc.ViewDataDictionary{{TModel}}
public ViewDataDictionary<TModel> ViewData { get; }

Methods

CheckBoxFor(System.Linq.Expressions.Expression<System.Func<TModel, System.Boolean>>, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},System.Boolean}}) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString CheckBoxFor(Expression<Func<TModel, bool>> expression, object htmlAttributes)
Contextualize(Microsoft.AspNet.Mvc.ViewContext)
Arguments:
public override void Contextualize(ViewContext viewContext)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.DisplayFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.String, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • templateName (System.String) –
  • htmlFieldName (System.String) –
  • additionalViewData (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString DisplayFor<TResult>(Expression<Func<TModel, TResult>> expression, string templateName, string htmlFieldName, object additionalViewData)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.DisplayNameForInnerType<TModelItem, TResult>(System.Linq.Expressions.Expression<System.Func<TModelItem, TResult>>)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModelItem},{TResult}}}) –
Return type:

System.String

public string DisplayNameForInnerType<TModelItem, TResult>(Expression<Func<TModelItem, TResult>> expression)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.DisplayNameFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
Return type:

System.String

public string DisplayNameFor<TResult>(Expression<Func<TModel, TResult>> expression)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.DisplayTextFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
Return type:

System.String

public string DisplayTextFor<TResult>(Expression<Func<TModel, TResult>> expression)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.DropDownListFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Collections.Generic.IEnumerable<Microsoft.AspNet.Mvc.Rendering.SelectListItem>, System.String, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • selectList (System.Collections.Generic.IEnumerable{Microsoft.AspNet.Mvc.Rendering.SelectListItem}) –
  • optionLabel (System.String) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString DropDownListFor<TResult>(Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, string optionLabel, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.EditorFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.String, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • templateName (System.String) –
  • htmlFieldName (System.String) –
  • additionalViewData (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString EditorFor<TResult>(Expression<Func<TModel, TResult>> expression, string templateName, string htmlFieldName, object additionalViewData)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.GetExpressionName<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
Return type:

System.String

protected string GetExpressionName<TResult>(Expression<Func<TModel, TResult>> expression)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.GetModelExplorer<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
Return type:

Microsoft.AspNet.Mvc.ModelBinding.ModelExplorer

protected ModelExplorer GetModelExplorer<TResult>(Expression<Func<TModel, TResult>> expression)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.HiddenFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString HiddenFor<TResult>(Expression<Func<TModel, TResult>> expression, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.IdFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
Return type:

System.String

public string IdFor<TResult>(Expression<Func<TModel, TResult>> expression)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.LabelFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • labelText (System.String) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString LabelFor<TResult>(Expression<Func<TModel, TResult>> expression, string labelText, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.ListBoxFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Collections.Generic.IEnumerable<Microsoft.AspNet.Mvc.Rendering.SelectListItem>, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • selectList (System.Collections.Generic.IEnumerable{Microsoft.AspNet.Mvc.Rendering.SelectListItem}) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString ListBoxFor<TResult>(Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.NameFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
Return type:

System.String

public string NameFor<TResult>(Expression<Func<TModel, TResult>> expression)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.PasswordFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString PasswordFor<TResult>(Expression<Func<TModel, TResult>> expression, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.RadioButtonFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • value (System.Object) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString RadioButtonFor<TResult>(Expression<Func<TModel, TResult>> expression, object value, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.TextAreaFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Int32, System.Int32, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • rows (System.Int32) –
  • columns (System.Int32) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString TextAreaFor<TResult>(Expression<Func<TModel, TResult>> expression, int rows, int columns, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.TextBoxFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • format (System.String) –
  • htmlAttributes (System.Object) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString TextBoxFor<TResult>(Expression<Func<TModel, TResult>> expression, string format, object htmlAttributes)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.ValidationMessageFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object, System.String)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • message (System.String) –
  • htmlAttributes (System.Object) –
  • tag (System.String) –
Return type:

Microsoft.AspNet.Mvc.Rendering.HtmlString

public HtmlString ValidationMessageFor<TResult>(Expression<Func<TModel, TResult>> expression, string message, object htmlAttributes, string tag)
Microsoft.AspNet.Mvc.Rendering.HtmlHelper<TModel>.ValueFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String)
Arguments:
  • expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) –
  • format (System.String) –
Return type:

System.String

public string ValueFor<TResult>(Expression<Func<TModel, TResult>> expression, string format)