DefaultHtmlGenerator Class

Definition

Default implementation of IHtmlGenerator.

public ref class DefaultHtmlGenerator : Microsoft::AspNetCore::Mvc::ViewFeatures::IHtmlGenerator
public class DefaultHtmlGenerator : Microsoft.AspNetCore.Mvc.ViewFeatures.IHtmlGenerator
type DefaultHtmlGenerator = class
    interface IHtmlGenerator
Public Class DefaultHtmlGenerator
Implements IHtmlGenerator
Inheritance
DefaultHtmlGenerator
Implements

Constructors

DefaultHtmlGenerator(IAntiforgery, IOptions<MvcViewOptions>, IModelMetadataProvider, IUrlHelperFactory, HtmlEncoder, ClientValidatorCache, ValidationHtmlAttributeProvider)

Initializes a new instance of the DefaultHtmlGenerator class.

DefaultHtmlGenerator(IAntiforgery, IOptions<MvcViewOptions>, IModelMetadataProvider, IUrlHelperFactory, HtmlEncoder, ClientValidatorCache)
Obsolete.

Initializes a new instance of the DefaultHtmlGenerator class.

This constructor is obsolete and will be removed in a future version. The recommended alternative is to use DefaultHtmlGenerator(IAntiforgery, IOptions<MvcViewOptions>, IModelMetadataProvider, IUrlHelperFactory, HtmlEncoder, ClientValidatorCache, ValidationHtmlAttributeProvider).

DefaultHtmlGenerator(IAntiforgery, IOptions<MvcViewOptions>, IModelMetadataProvider, IUrlHelperFactory, HtmlEncoder, ValidationHtmlAttributeProvider)

Initializes a new instance of the DefaultHtmlGenerator class.

Properties

AllowRenderingMaxLengthAttribute

Gets or sets a value that indicates whether the maxlength attribute should be rendered for compatible HTML input elements, when they're bound to models marked with either StringLengthAttribute or MaxLengthAttribute attributes.

IdAttributeDotReplacement

Gets the replacement for '.' in an Id attribute.

Methods

AddMaxLengthAttribute(ViewDataDictionary, TagBuilder, ModelExplorer, String)

Adds a maxlength attribute to the tagBuilder.

AddPlaceholderAttribute(ViewDataDictionary, TagBuilder, ModelExplorer, String)

Adds a placeholder attribute to the tagBuilder.

AddValidationAttributes(ViewContext, TagBuilder, ModelExplorer, String)

Adds validation attributes to the tagBuilder if client validation is enabled.

Encode(Object)

Encodes a value.

Encode(String)

Encodes a value.

FormatValue(Object, String)

Format a value.

GenerateActionLink(ViewContext, String, String, String, String, String, String, Object, Object)

Generate a <a> element for a link to an action.

GenerateAntiforgery(ViewContext)

Generate an <input type="hidden".../> element containing an antiforgery token.

GenerateCheckBox(ViewContext, ModelExplorer, String, Nullable<Boolean>, Object)

Generate a <input type="checkbox".../> element.

GenerateForm(ViewContext, String, String, Object, String, Object)

Generate a <form> element. When the user submits the form, the action with name actionName will process the request.

GenerateFormCore(ViewContext, String, String, Object)

Generate a <form> element.

GenerateGroupsAndOptions(String, IEnumerable<SelectListItem>)

Generates <optgroup> and <option> elements.

GenerateHidden(ViewContext, ModelExplorer, String, Object, Boolean, Object)

Generate a <input type="hidden"> element

GenerateHiddenForCheckbox(ViewContext, ModelExplorer, String)

Generate an additional <input type="hidden".../> for checkboxes. This addresses scenarios where unchecked checkboxes are not sent in the request. Sending a hidden input makes it possible to know that the checkbox was present on the page when the request was submitted.

GenerateInput(ViewContext, InputType, ModelExplorer, String, Object, Boolean, Boolean, Boolean, Boolean, String, IDictionary<String,Object>)

Generate an input tag.

GenerateLabel(ViewContext, ModelExplorer, String, String, Object)

Generate a <label> element

GenerateLink(String, String, Object)

Generate a link.

GeneratePageForm(ViewContext, String, String, Object, String, String, Object)

Generate a <form> element. When the user submits the form, the page with name pageName will process the request.

GeneratePageLink(ViewContext, String, String, String, String, String, String, Object, Object)

Generate a <a> element for a link to an action.

GeneratePassword(ViewContext, ModelExplorer, String, Object, Object)

Generate a <input type="password"> element

GenerateRadioButton(ViewContext, ModelExplorer, String, Object, Nullable<Boolean>, Object)

Generate a <input type="radio"> element

GenerateRouteForm(ViewContext, String, Object, String, Object)

Generate a <form> element. The route with name routeName generates the <form>'s action attribute value.

GenerateRouteLink(ViewContext, String, String, String, String, String, Object, Object)

Generate a <a> element for a link to an action.

GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, Boolean, Object)

Generate a <select> element for the expression.

GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, ICollection<String>, Boolean, Object)

Generate a <select> element for the expression.

GenerateTextArea(ViewContext, ModelExplorer, String, Int32, Int32, Object)

Generates a <textarea> element

GenerateTextBox(ViewContext, ModelExplorer, String, Object, String, Object)

Generates a <input type="text"> element

GenerateValidationMessage(ViewContext, ModelExplorer, String, String, String, Object)

Generate a tag element if the viewContext's ModelState contains an error for the expression.

GenerateValidationSummary(ViewContext, Boolean, String, String, Object)

Generates a <div> element which contains a list of validation errors.

GetCurrentValues(ViewContext, ModelExplorer, String, Boolean)

Gets the collection of current values for the given expression.

Extension Methods

GenerateForm(IHtmlGenerator, ViewContext, String, String, String, Object, String, Object)

Generates a form.

GenerateRouteForm(IHtmlGenerator, ViewContext, String, Object, String, String, Object)

Generates a form for a route.

Applies to