HtmlHelper<TModel> Class

Namespace
Microsoft.AspNetCore.Mvc.ViewFeatures
Assemblies
  • Microsoft.AspNetCore.Mvc.ViewFeatures

Syntax

public class HtmlHelper<TModel> : HtmlHelper, IViewContextAware, IHtmlHelper<TModel>, IHtmlHelper
class Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper<TModel>

Constructors

HtmlHelper(Microsoft.AspNetCore.Mvc.ViewFeatures.IHtmlGenerator, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.IViewBufferScope, System.Text.Encodings.Web.HtmlEncoder, System.Text.Encodings.Web.UrlEncoder, Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ExpressionTextCache)

Initializes a new instance of the Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper`1 class.

public HtmlHelper(IHtmlGenerator htmlGenerator, ICompositeViewEngine viewEngine, IModelMetadataProvider metadataProvider, IViewBufferScope bufferScope, HtmlEncoder htmlEncoder, UrlEncoder urlEncoder, ExpressionTextCache expressionTextCache)

Methods

CheckBoxFor(System.Linq.Expressions.Expression<System.Func<TModel, System.Boolean>>, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent CheckBoxFor(Expression<Func<TModel, bool>> expression, object htmlAttributes)
Contextualize(Microsoft.AspNetCore.Mvc.Rendering.ViewContext)
public override void Contextualize(ViewContext viewContext)
DisplayFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.String, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent DisplayFor<TResult>(Expression<Func<TModel, TResult>> expression, string templateName, string htmlFieldName, object additionalViewData)
DisplayNameForInnerType<TModelItem, TResult>(System.Linq.Expressions.Expression<System.Func<TModelItem, TResult>>)
Return type:System.String
public string DisplayNameForInnerType<TModelItem, TResult>(Expression<Func<TModelItem, TResult>> expression)
DisplayNameFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Return type:System.String
public string DisplayNameFor<TResult>(Expression<Func<TModel, TResult>> expression)
DisplayTextFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Return type:System.String
public string DisplayTextFor<TResult>(Expression<Func<TModel, TResult>> expression)
DropDownListFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>, System.String, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent DropDownListFor<TResult>(Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, string optionLabel, object htmlAttributes)
EditorFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.String, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent EditorFor<TResult>(Expression<Func<TModel, TResult>> expression, string templateName, string htmlFieldName, object additionalViewData)
GetExpressionName<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Return type:System.String
protected string GetExpressionName<TResult>(Expression<Func<TModel, TResult>> expression)
GetModelExplorer<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Return type:Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer
protected ModelExplorer GetModelExplorer<TResult>(Expression<Func<TModel, TResult>> expression)
HiddenFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent HiddenFor<TResult>(Expression<Func<TModel, TResult>> expression, object htmlAttributes)
IdFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Return type:System.String
public string IdFor<TResult>(Expression<Func<TModel, TResult>> expression)
LabelFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent LabelFor<TResult>(Expression<Func<TModel, TResult>> expression, string labelText, object htmlAttributes)
ListBoxFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent ListBoxFor<TResult>(Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, object htmlAttributes)
NameFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Return type:System.String
public string NameFor<TResult>(Expression<Func<TModel, TResult>> expression)
PasswordFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent PasswordFor<TResult>(Expression<Func<TModel, TResult>> expression, object htmlAttributes)
RadioButtonFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Object, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent RadioButtonFor<TResult>(Expression<Func<TModel, TResult>> expression, object value, object htmlAttributes)
TextAreaFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Int32, System.Int32, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent TextAreaFor<TResult>(Expression<Func<TModel, TResult>> expression, int rows, int columns, object htmlAttributes)
TextBoxFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent TextBoxFor<TResult>(Expression<Func<TModel, TResult>> expression, string format, object htmlAttributes)
ValidationMessageFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object, System.String)
Return type:Microsoft.AspNetCore.Html.IHtmlContent
public IHtmlContent ValidationMessageFor<TResult>(Expression<Func<TModel, TResult>> expression, string message, object htmlAttributes, string tag)
ValueFor<TResult>(System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String)
Return type:System.String
public string ValueFor<TResult>(Expression<Func<TModel, TResult>> expression, string format)

Properties

Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper<TModel>.ViewData
Return type:Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<TModel>
public ViewDataDictionary<TModel> ViewData { get; }