Export (0) Print
Expand All

HtmlHelper Class

.NET Framework 4

Represents support for rendering HTML controls in a view.

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

public ref class HtmlHelper

The HtmlHelper type exposes the following members.

  NameDescription
Public methodHtmlHelper(ViewContext, IViewDataContainer)Initializes a new instance of the HtmlHelper class by using the specified view context and view data container.
Public methodHtmlHelper(ViewContext, IViewDataContainer, RouteCollection)Initializes a new instance of the HtmlHelper class by using the specified view context, view data container, and route collection.
Top

  NameDescription
Public propertyStatic memberIdAttributeDotReplacementGets or sets the character that replaces periods in the ID attribute of an element.
Public propertyRouteCollectionGets or sets the collection of routes for the application.
Public propertyViewContextGets or sets the context information about the view.
Public propertyViewDataGets the current view data dictionary.
Public propertyViewDataContainerGets or sets the view data container.
Top

  NameDescription
Public methodAntiForgeryToken()Generates a hidden form field (anti-forgery token) that is validated when the form is submitted.
Public methodAntiForgeryToken(String)Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. The field value is generated using the specified salt value.
Public methodAntiForgeryToken(String, String, String)Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. The field value is generated using the specified salt value, domain, and path.
Public methodAttributeEncode(Object)Converts the specified attribute object to an HTML-encoded string.
Public methodAttributeEncode(String)Converts the specified attribute string to an HTML-encoded string.
Public methodEnableClientValidationEnables input validation that is performed by using client script in the browser.
Public methodEncode(Object)Converts the value of the specified object to an HTML-encoded string.
Public methodEncode(String)Converts the specified string to an HTML-encoded string.
Public methodEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic memberGenerateIdFromName(String)Creates an HTML element ID using the specified element name.
Public methodStatic memberGenerateIdFromName(String, String)Creates an HTML element ID using the specified element name and a string that replaces dots in the name.
Public methodStatic memberGenerateLink(RequestContext, RouteCollection, String, String, String, String, RouteValueDictionary, IDictionary<String, Object>)Generates an HTML anchor element (a element) that links to the specified action method.
Public methodStatic memberGenerateLink(RequestContext, RouteCollection, String, String, String, String, String, String, String, RouteValueDictionary, IDictionary<String, Object>)Generates an HTML anchor element (a element) that links to the specified action method, and enables the user to specify the communication protocol, name of the host, and a URL fragment.
Public methodStatic memberGenerateRouteLink(RequestContext, RouteCollection, String, String, RouteValueDictionary, IDictionary<String, Object>)Generates an HTML anchor element (a element) that links to the specified URL route.
Public methodStatic memberGenerateRouteLink(RequestContext, RouteCollection, String, String, String, String, String, RouteValueDictionary, IDictionary<String, Object>)Generates an HTML anchor element (a element) that links to the specified URL route, and enables the user to specify the communication protocol, name of the host, and a URL fragment.
Public methodStatic memberGetFormMethodStringReturns the HTTP method that handles form input (GET or POST) as a string.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodStatic memberGetInputTypeStringReturns the HTML input control type as a string.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodHttpMethodOverride(String)Returns a hidden input element that identifies the override method for the specified HTTP data-transfer method that was used by the client.
Public methodHttpMethodOverride(HttpVerbs)Returns a hidden input element that identifies the override method for the specified verb that represents the HTTP data-transfer method used by the client.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public Extension MethodAction(String)Overloaded. Invokes the specified child action method and returns the result as an HTML string. (Defined by ChildActionExtensions.)
Public Extension MethodAction(String, Object)Overloaded. Invokes the specified child action method with the specified parameters and returns the result as an HTML string. (Defined by ChildActionExtensions.)
Public Extension MethodAction(String, RouteValueDictionary)Overloaded. Invokes the specified child action method using the specified parameters and returns the result as an HTML string. (Defined by ChildActionExtensions.)
Public Extension MethodAction(String, String)Overloaded. Invokes the specified child action method using the specified controller name and returns the result as an HTML string. (Defined by ChildActionExtensions.)
Public Extension MethodAction(String, String, Object)Overloaded. Invokes the specified child action method using the specified parameters and controller name and returns the result as an HTML string. (Defined by ChildActionExtensions.)
Public Extension MethodAction(String, String, RouteValueDictionary)Overloaded. Invokes the specified child action method using the specified parameters and controller name and returns the result as an HTML string. (Defined by ChildActionExtensions.)
Public Extension MethodActionLink(String, String)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, RouteValueDictionary)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, String)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, Object, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, RouteValueDictionary, IDictionary<String, Object>)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, String, Object, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, String, RouteValueDictionary, IDictionary<String, Object>)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, String, String, String, String, Object, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodActionLink(String, String, String, String, String, String, RouteValueDictionary, IDictionary<String, Object>)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodBeginForm()Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(Object)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(RouteValueDictionary)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, Object)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, RouteValueDictionary)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, FormMethod)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, Object, FormMethod)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, RouteValueDictionary, FormMethod)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, FormMethod, Object)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, FormMethod, IDictionary<String, Object>)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, Object, FormMethod, Object)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginForm(String, String, RouteValueDictionary, FormMethod, IDictionary<String, Object>)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by an action method. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(Object)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(RouteValueDictionary)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, Object)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, RouteValueDictionary)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, FormMethod)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, Object, FormMethod)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, RouteValueDictionary, FormMethod)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, FormMethod, Object)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, FormMethod, IDictionary<String, Object>)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, Object, FormMethod, Object)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodBeginRouteForm(String, RouteValueDictionary, FormMethod, IDictionary<String, Object>)Overloaded. Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target. (Defined by FormExtensions.)
Public Extension MethodCheckBox(String)Overloaded. Returns a check box input element by using the specified HTML helper and the name of the form field. (Defined by InputExtensions.)
Public Extension MethodCheckBox(String, Boolean)Overloaded. Returns a check box input element by using the specified HTML helper, the name of the form field, and a value to indicate whether the check box is selected. (Defined by InputExtensions.)
Public Extension MethodCheckBox(String, Object)Overloaded. Returns a check box input element by using the specified HTML helper, the name of the form field, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodCheckBox(String, IDictionary<String, Object>)Overloaded. Returns a check box input element by using the specified HTML helper, the name of the form field, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodCheckBox(String, Boolean, Object)Overloaded. Returns a check box input element by using the specified HTML helper, the name of the form field, a value that indicates whether the check box is selected, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodCheckBox(String, Boolean, IDictionary<String, Object>)Overloaded. Returns a check box input element by using the specified HTML helper, the name of the form field, a value to indicate whether the check box is selected, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodDisplay(String)Overloaded. Returns HTML markup for each property in the object that is represented by a string expression. (Defined by DisplayExtensions.)
Public Extension MethodDisplay(String, Object)Overloaded. Returns HTML markup for each property in the object that is represented by a string expression, using additional view data. (Defined by DisplayExtensions.)
Public Extension MethodDisplay(String, String)Overloaded. Returns HTML markup for each property in the object that is represented by the expression, using the specified template. (Defined by DisplayExtensions.)
Public Extension MethodDisplay(String, String, Object)Overloaded. Returns HTML markup for each property in the object that is represented by the expression, using the specified template and additional view data. (Defined by DisplayExtensions.)
Public Extension MethodDisplay(String, String, String)Overloaded. Returns HTML markup for each property in the object that is represented by the expression, using the specified template and an HTML field ID. (Defined by DisplayExtensions.)
Public Extension MethodDisplay(String, String, String, Object)Overloaded. Returns HTML markup for each property in the object that is represented by the expression, using the specified template, HTML field ID, and additional view data. (Defined by DisplayExtensions.)
Public Extension MethodDisplayForModel()Overloaded. Returns HTML markup for each property in the model. (Defined by DisplayExtensions.)
Public Extension MethodDisplayForModel(Object)Overloaded. Returns HTML markup for each property in the model, using additional view data. (Defined by DisplayExtensions.)
Public Extension MethodDisplayForModel(String)Overloaded. Returns HTML markup for each property in the model using the specified template. (Defined by DisplayExtensions.)
Public Extension MethodDisplayForModel(String, Object)Overloaded. Returns HTML markup for each property in the model, using the specified template and additional view data. (Defined by DisplayExtensions.)
Public Extension MethodDisplayForModel(String, String)Overloaded. Returns HTML markup for each property in the model using the specified template and HTML field ID. (Defined by DisplayExtensions.)
Public Extension MethodDisplayForModel(String, String, Object)Overloaded. Returns HTML markup for each property in the model, using the specified template, an HTML field ID, and additional view data. (Defined by DisplayExtensions.)
Public Extension MethodDisplayTextReturns HTML markup for each property in the object that is represented by the specified expression. (Defined by DisplayTextExtensions.)
Public Extension MethodDropDownList(String)Overloaded. Returns a single-selection select element using the specified HTML helper and the name of the form field. (Defined by SelectExtensions.)
Public Extension MethodDropDownList(String, String)Overloaded. Returns a single-selection select element using the specified HTML helper, the name of the form field, and an option label. (Defined by SelectExtensions.)
Public Extension MethodDropDownList(String, IEnumerable<SelectListItem>)Overloaded. Returns a single-selection select element using the specified HTML helper, the name of the form field, and the specified list items. (Defined by SelectExtensions.)
Public Extension MethodDropDownList(String, IEnumerable<SelectListItem>, Object)Overloaded. Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HTML attributes. (Defined by SelectExtensions.)
Public Extension MethodDropDownList(String, IEnumerable<SelectListItem>, IDictionary<String, Object>)Overloaded. Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HTML attributes. (Defined by SelectExtensions.)
Public Extension MethodDropDownList(String, IEnumerable<SelectListItem>, String)Overloaded. Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and an option label. (Defined by SelectExtensions.)
Public Extension MethodDropDownList(String, IEnumerable<SelectListItem>, String, Object)Overloaded. Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, an option label, and the specified HTML attributes. (Defined by SelectExtensions.)
Public Extension MethodDropDownList(String, IEnumerable<SelectListItem>, String, IDictionary<String, Object>)Overloaded. Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, an option label, and the specified HTML attributes. (Defined by SelectExtensions.)
Public Extension MethodEditor(String)Overloaded. Returns an HTML input element for each property in the object that is represented by the expression. (Defined by EditorExtensions.)
Public Extension MethodEditor(String, Object)Overloaded. Returns an HTML input element for each property in the object that is represented by the expression, using additional view data. (Defined by EditorExtensions.)
Public Extension MethodEditor(String, String)Overloaded. Returns an HTML input element for each property in the object that is represented by the expression, using the specified template. (Defined by EditorExtensions.)
Public Extension MethodEditor(String, String, Object)Overloaded. Returns an HTML input element for each property in the object that is represented by the expression, using the specified template and additional view data. (Defined by EditorExtensions.)
Public Extension MethodEditor(String, String, String)Overloaded. Returns an HTML input element for each property in the object that is represented by the expression, using the specified template and HTML field name. (Defined by EditorExtensions.)
Public Extension MethodEditor(String, String, String, Object)Overloaded. Returns an HTML input element for each property in the object that is represented by the expression, using the specified template, HTML field name, and additional view data. (Defined by EditorExtensions.)
Public Extension MethodEditorForModel()Overloaded. Returns an HTML input element for each property in the model. (Defined by EditorExtensions.)
Public Extension MethodEditorForModel(Object)Overloaded. Returns an HTML input element for each property in the model, using additional view data. (Defined by EditorExtensions.)
Public Extension MethodEditorForModel(String)Overloaded. Returns an HTML input element for each property in the model, using the specified template. (Defined by EditorExtensions.)
Public Extension MethodEditorForModel(String, Object)Overloaded. Returns an HTML input element for each property in the model, using the specified template and additional view data. (Defined by EditorExtensions.)
Public Extension MethodEditorForModel(String, String)Overloaded. Returns an HTML input element for each property in the model, using the specified template name and HTML field name. (Defined by EditorExtensions.)
Public Extension MethodEditorForModel(String, String, Object)Overloaded. Returns an HTML input element for each property in the model, using the template name, HTML field name, and additional view data. (Defined by EditorExtensions.)
Public Extension MethodEndFormRenders the closing </form> tag to the response. (Defined by FormExtensions.)
Public Extension MethodHidden(String)Overloaded. Returns a hidden input element by using the specified HTML helper and the name of the form field. (Defined by InputExtensions.)
Public Extension MethodHidden(String, Object)Overloaded. Returns a hidden input element by using the specified HTML helper, the name of the form field, and the value. (Defined by InputExtensions.)
Public Extension MethodHidden(String, Object, Object)Overloaded. Returns a hidden input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodHidden(String, Object, IDictionary<String, Object>)Overloaded. Returns a hidden input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodLabelReturns an HTML label element and the property name of the property that is represented by the specified expression. (Defined by LabelExtensions.)
Public Extension MethodLabelForModelReturns an HTML label element and the property name of the property that is represented by the model. (Defined by LabelExtensions.)
Public Extension MethodListBox(String)Overloaded. Returns a multi-select select element using the specified HTML helper and the name of the form field. (Defined by SelectExtensions.)
Public Extension MethodListBox(String, IEnumerable<SelectListItem>)Overloaded. Returns a multi-select select element using the specified HTML helper, the name of the form field, and the specified list items. (Defined by SelectExtensions.)
Public Extension MethodListBox(String, IEnumerable<SelectListItem>, Object)Overloaded. Returns a multi-select select element using the specified HTML helper, the name of the form field, and the specified list items. (Defined by SelectExtensions.)
Public Extension MethodListBox(String, IEnumerable<SelectListItem>, IDictionary<String, Object>)Overloaded. Returns a multi-select select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HMTL attributes. (Defined by SelectExtensions.)
Public Extension MethodPartial(String)Overloaded. Renders the specified partial view as an HTML-encoded string. (Defined by PartialExtensions.)
Public Extension MethodPartial(String, ViewDataDictionary)Overloaded. Renders the specified partial view as an HTML-encoded string. (Defined by PartialExtensions.)
Public Extension MethodPartial(String, Object)Overloaded. Renders the specified partial view as an HTML-encoded string. (Defined by PartialExtensions.)
Public Extension MethodPartial(String, Object, ViewDataDictionary)Overloaded. Renders the specified partial view as an HTML-encoded string. (Defined by PartialExtensions.)
Public Extension MethodPassword(String)Overloaded. Returns a password input element by using the specified HTML helper and the name of the form field. (Defined by InputExtensions.)
Public Extension MethodPassword(String, Object)Overloaded. Returns a password input element by using the specified HTML helper, the name of the form field, and the value. (Defined by InputExtensions.)
Public Extension MethodPassword(String, Object, Object)Overloaded. Returns a password input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodPassword(String, Object, IDictionary<String, Object>)Overloaded. Returns a password input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodRadioButton(String, Object)Overloaded. Returns a radio button input element that is used to present mutually exclusive options. (Defined by InputExtensions.)
Public Extension MethodRadioButton(String, Object, Object)Overloaded. Returns a radio button input element that is used to present mutually exclusive options. (Defined by InputExtensions.)
Public Extension MethodRadioButton(String, Object, IDictionary<String, Object>)Overloaded. Returns a radio button input element that is used to present mutually exclusive options. (Defined by InputExtensions.)
Public Extension MethodRadioButton(String, Object, Boolean)Overloaded. Returns a radio button input element that is used to present mutually exclusive options. (Defined by InputExtensions.)
Public Extension MethodRadioButton(String, Object, Boolean, Object)Overloaded. Returns a radio button input element that is used to present mutually exclusive options. (Defined by InputExtensions.)
Public Extension MethodRadioButton(String, Object, Boolean, IDictionary<String, Object>)Overloaded. Returns a radio button input element that is used to present mutually exclusive options. (Defined by InputExtensions.)
Public Extension MethodRenderAction(String)Overloaded. Invokes the specified child action method and renders the result inline in the parent view. (Defined by ChildActionExtensions.)
Public Extension MethodRenderAction(String, Object)Overloaded. Invokes the specified child action method using the specified parameters and renders the result inline in the parent view. (Defined by ChildActionExtensions.)
Public Extension MethodRenderAction(String, RouteValueDictionary)Overloaded. Invokes the specified child action method using the specified parameters and renders the result inline in the parent view. (Defined by ChildActionExtensions.)
Public Extension MethodRenderAction(String, String)Overloaded. Invokes the specified child action method using the specified controller name and renders the result inline in the parent view. (Defined by ChildActionExtensions.)
Public Extension MethodRenderAction(String, String, Object)Overloaded. Invokes the specified child action method using the specified parameters and controller name and renders the result inline in the parent view. (Defined by ChildActionExtensions.)
Public Extension MethodRenderAction(String, String, RouteValueDictionary)Overloaded. Invokes the specified child action method using the specified parameters and controller name and renders the result inline in the parent view. (Defined by ChildActionExtensions.)
Public Extension MethodRenderPartial(String)Overloaded. Renders the specified partial view by using the specified HMTL helper. (Defined by RenderPartialExtensions.)
Public Extension MethodRenderPartial(String, ViewDataDictionary)Overloaded. Renders the specified partial view, replacing its ViewData property with the specified ViewDataDictionary object. (Defined by RenderPartialExtensions.)
Public Extension MethodRenderPartial(String, Object)Overloaded. Renders the specified partial view, passing it a copy of the current ViewDataDictionary object, but with the Model property set to the specified model. (Defined by RenderPartialExtensions.)
Public Extension MethodRenderPartial(String, Object, ViewDataDictionary)Overloaded. Renders the specified partial view, replacing the partial view's ViewData property with the specified ViewDataDictionary object and setting the Model property of the view data to the specified model. (Defined by RenderPartialExtensions.)
Public Extension MethodRouteLink(String, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, RouteValueDictionary)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, String)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, String, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, String, RouteValueDictionary)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, Object, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, RouteValueDictionary, IDictionary<String, Object>)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, String, Object, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, String, RouteValueDictionary, IDictionary<String, Object>)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, String, String, String, String, Object, Object)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodRouteLink(String, String, String, String, String, RouteValueDictionary, IDictionary<String, Object>)Overloaded. Returns an anchor element (a element) that contains the virtual path of the specified action. (Defined by LinkExtensions.)
Public Extension MethodTextArea(String)Overloaded. Returns the specified textarea element by using the specified HTML helper and the name of the form field. (Defined by TextAreaExtensions.)
Public Extension MethodTextArea(String, Object)Overloaded. Returns the specified textarea element by using the specified HTML helper and HTML attributes. (Defined by TextAreaExtensions.)
Public Extension MethodTextArea(String, IDictionary<String, Object>)Overloaded. Returns the specified textarea element by using the specified HTML helper, the name of the form field, and the specified HTML attributes. (Defined by TextAreaExtensions.)
Public Extension MethodTextArea(String, String)Overloaded. Returns the specified textarea element by using the specified HTML helper, the name of the form field, and the text content. (Defined by TextAreaExtensions.)
Public Extension MethodTextArea(String, String, Object)Overloaded. Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, and the specified HTML attributes. (Defined by TextAreaExtensions.)
Public Extension MethodTextArea(String, String, IDictionary<String, Object>)Overloaded. Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, and the specified HTML attributes. (Defined by TextAreaExtensions.)
Public Extension MethodTextArea(String, String, Int32, Int32, Object)Overloaded. Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, the number of rows and columns, and the specified HTML attributes. (Defined by TextAreaExtensions.)
Public Extension MethodTextArea(String, String, Int32, Int32, IDictionary<String, Object>)Overloaded. Returns the specified textarea element by using the specified HTML helper, the name of the form field, the text content, the number of rows and columns, and the specified HTML attributes. (Defined by TextAreaExtensions.)
Public Extension MethodTextBox(String)Overloaded. Returns a text input element by using the specified HTML helper and the name of the form field. (Defined by InputExtensions.)
Public Extension MethodTextBox(String, Object)Overloaded. Returns a text input element by using the specified HTML helper, the name of the form field, and the value. (Defined by InputExtensions.)
Public Extension MethodTextBox(String, Object, Object)Overloaded. Returns a text input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodTextBox(String, Object, IDictionary<String, Object>)Overloaded. Returns a text input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. (Defined by InputExtensions.)
Public Extension MethodValidateRetrieves the validation metadata for the specified model and applies each rule to the data field. (Defined by ValidationExtensions.)
Public Extension MethodValidationMessage(String)Overloaded. Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationMessage(String, Object)Overloaded. Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationMessage(String, String)Overloaded. Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationMessage(String, IDictionary<String, Object>)Overloaded. Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationMessage(String, String, Object)Overloaded. Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationMessage(String, String, IDictionary<String, Object>)Overloaded. Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationSummary()Overloaded. Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationSummary(Boolean)Overloaded. Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object and optionally displays only model-level errors. (Defined by ValidationExtensions.)
Public Extension MethodValidationSummary(String)Overloaded. Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationSummary(Boolean, String)Overloaded. Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object and optionally displays only model-level errors. (Defined by ValidationExtensions.)
Public Extension MethodValidationSummary(String, Object)Overloaded. Returns an unordered list (ul element) of validation messages in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationSummary(String, IDictionary<String, Object>)Overloaded. Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object. (Defined by ValidationExtensions.)
Public Extension MethodValidationSummary(Boolean, String, Object)Overloaded. Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object and optionally displays only model-level errors. (Defined by ValidationExtensions.)
Public Extension MethodValidationSummary(Boolean, String, IDictionary<String, Object>)Overloaded. Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object and optionally displays only model-level errors. (Defined by ValidationExtensions.)
Top

  NameDescription
Public fieldStatic memberValidationInputCssClassNameThe name of the CSS class that is used to style an input field when a validation error occurs.
Public fieldStatic memberValidationInputValidCssClassNameThe name of the CSS class that is used to style an input field when the input is valid.
Public fieldStatic memberValidationMessageCssClassNameThe name of the CSS class that is used to style the error message when a validation error occurs.
Public fieldStatic memberValidationMessageValidCssClassNameThe name of the CSS class that is used to style the validation message when the input is valid.
Public fieldStatic memberValidationSummaryCssClassNameThe name of the CSS class that is used to style validation summary error messages.
Public fieldStatic memberValidationSummaryValidCssClassNameThe name of the CSS class that is used to style the validation summary when the input is valid.
Top

The HtmlHelper class provides methods that help you create HTML controls programmatically. All HtmlHelper methods generate HTML and return the result as a string.

NoteNote

The HtmlHelper class is designed to generate UI. It should not be used in controllers or models.

Extension methods for the HtmlHelper class are in the System.Web.Mvc.Html namespace. These extensions add helper methods for creating forms, rendering HTML controls, rendering partial views, performing input validation, and more.

Helper methods and extensions are called using the Html property of the view, which is an instance of the HtmlHelper class. For example, to generate a check box in a form, you call the CheckBox method in a view using the following syntax:

<%= Html.CheckBox("OptionName") %>

The following example shows how to use the HtmlHelper class and shows how to use the methods of the InputExtensions class. The view displays a text box, a password box, some radio buttons, and some check boxes.

No code example is currently available or this language may not be supported.

The following example shows a form. When the user submits the form, the Input action method processes the form data and renders a view.

No code example is currently available or this language may not be supported.

In the following example, the view displays the data that was submitted.

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft