Class FormExtensions
Represents support for HTML in an application.
public static class FormExtensions
- Inheritance
-
FormExtensions
- Inherited Members
Methods
BeginForm(HtmlHelper)
Writes an opening <form> tag to the response. The form uses the POST method, and the request is processed by the action method for the view.
public static MvcForm BeginForm(this HtmlHelper htmlHelper)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, object)
Writes an opening <form> tag to the response and includes the route values in the action attribute. The form uses the POST method, and the request is processed by the action method for the view.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, object routeValues)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeValues
objectAn object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string)
Writes an opening <form> tag to the response and sets the action tag to the specified controller and action. The form uses the POST method.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, object)
Writes an opening <form> tag to the response, and sets the action tag to the specified controller, action, and route values. The form uses the POST method.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, object routeValues)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
routeValues
objectAn object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, object, FormMethod)
Writes an opening <form> tag to the response and sets the action tag to the specified controller, action, and route values. The form uses the specified HTTP method.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, object routeValues, FormMethod method)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
routeValues
objectAn object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, object, FormMethod, object)
Writes an opening <form> tag to the response and sets the action tag to the specified controller, action, and route values. The form uses the specified HTTP method and includes the HTML attributes.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, object routeValues, FormMethod method, object htmlAttributes)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
routeValues
objectAn object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
htmlAttributes
objectAn object that contains the HTML attributes to set for the element.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, FormMethod)
Writes an opening <form> tag to the response and sets the action tag to the specified controller and action. The form uses the specified HTTP method.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, FormMethod, IDictionary<string, object>)
Writes an opening <form> tag to the response and sets the action tag to the specified controller and action. The form uses the specified HTTP method and includes the HTML attributes from a dictionary.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
htmlAttributes
IDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, FormMethod, object)
Writes an opening <form> tag to the response and sets the action tag to the specified controller and action. The form uses the specified HTTP method and includes the HTML attributes.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, FormMethod method, object htmlAttributes)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
htmlAttributes
objectAn object that contains the HTML attributes to set for the element.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, RouteValueDictionary)
Writes an opening <form> tag to the response, and sets the action tag to the specified controller, action, and route values from the route value dictionary. The form uses the POST method.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
routeValues
RouteValueDictionaryAn object that contains the parameters for a route.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, RouteValueDictionary, FormMethod)
Writes an opening <form> tag to the response, and sets the action tag to the specified controller, action, and route values from the route value dictionary. The form uses the specified HTTP method.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues, FormMethod method)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
routeValues
RouteValueDictionaryAn object that contains the parameters for a route.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, string, string, RouteValueDictionary, FormMethod, IDictionary<string, object>)
Writes an opening <form> tag to the response, and sets the action tag to the specified controller, action, and route values from the route value dictionary. The form uses the specified HTTP method, and includes the HTML attributes from the dictionary.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues, FormMethod method, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
actionName
stringThe name of the action method.
controllerName
stringThe name of the controller.
routeValues
RouteValueDictionaryAn object that contains the parameters for a route.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
htmlAttributes
IDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcForm
An opening <form> tag.
BeginForm(HtmlHelper, RouteValueDictionary)
Writes an opening <form> tag to the response and includes the route values from the route value dictionary in the action attribute. The form uses the POST method, and the request is processed by the action method for the view.
public static MvcForm BeginForm(this HtmlHelper htmlHelper, RouteValueDictionary routeValues)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeValues
RouteValueDictionaryAn object that contains the parameters for a route.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, object)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, object routeValues)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeValues
objectAn object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, object)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, object routeValues)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
routeValues
objectAn object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, object, FormMethod)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, object routeValues, FormMethod method)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
routeValues
objectAn object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, object, FormMethod, object)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, object routeValues, FormMethod method, object htmlAttributes)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
routeValues
objectAn object that contains the parameters for a route. The parameters are retrieved through reflection by examining the properties of the object. This object is typically created by using object initializer syntax.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
htmlAttributes
objectAn object that contains the HTML attributes to set for the element.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, FormMethod)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, FormMethod method)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, FormMethod, IDictionary<string, object>)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, FormMethod method, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
htmlAttributes
IDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, FormMethod, object)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, FormMethod method, object htmlAttributes)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
method
FormMethodThe HTTP method for processing the form, either GET or POST.
htmlAttributes
objectAn object that contains the HTML attributes to set for the element.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, RouteValueDictionary)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, RouteValueDictionary routeValues)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
routeValues
RouteValueDictionaryAn object that contains the parameters for a route
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, RouteValueDictionary, FormMethod)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, RouteValueDictionary routeValues, FormMethod method)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
routeValues
RouteValueDictionaryAn object that contains the parameters for a route
method
FormMethodThe HTTP method for processing the form, either GET or POST.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, string, RouteValueDictionary, FormMethod, IDictionary<string, object>)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, string routeName, RouteValueDictionary routeValues, FormMethod method, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeName
stringThe name of the route to use to obtain the form-post URL.
routeValues
RouteValueDictionaryAn object that contains the parameters for a route
method
FormMethodThe HTTP method for processing the form, either GET or POST.
htmlAttributes
IDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcForm
An opening <form> tag.
BeginRouteForm(HtmlHelper, RouteValueDictionary)
Writes an opening <form> tag to the response. When the user submits the form, the request will be processed by the route target.
public static MvcForm BeginRouteForm(this HtmlHelper htmlHelper, RouteValueDictionary routeValues)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
routeValues
RouteValueDictionaryAn object that contains the parameters for a route
Returns
- MvcForm
An opening <form> tag.
EndForm(HtmlHelper)
Renders the closing </form> tag to the response.
public static void EndForm(this HtmlHelper htmlHelper)
Parameters
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.