FormExtensions.BeginForm<TController> Method (HtmlHelper, Expression<Action<TController>>, FormMethod, Object)
Writes an opening form tag to the response. When the user submits the form, the request will be processed by an action method.
Namespace: Microsoft.Web.Mvc
Assembly: Microsoft.Web.Mvc (in Microsoft.Web.Mvc.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Function BeginForm(Of TController As Controller) ( _
helper As HtmlHelper, _
action As Expression(Of Action(Of TController)), _
method As FormMethod, _
htmlAttributes As Object _
) As MvcForm
'Usage
Dim helper As HtmlHelper
Dim action As Expression(Of Action(Of TController))
Dim method As FormMethod
Dim htmlAttributes As Object
Dim returnValue As MvcForm
returnValue = helper.BeginForm(action, _
method, htmlAttributes)
public static MvcForm BeginForm<TController>(
this HtmlHelper helper,
Expression<Action<TController>> action,
FormMethod method,
Object htmlAttributes
)
where TController : Controller
[ExtensionAttribute]
public:
generic<typename TController>
where TController : Controller
static MvcForm^ BeginForm(
HtmlHelper^ helper,
Expression<Action<TController>^>^ action,
FormMethod method,
Object^ htmlAttributes
)
static member BeginForm :
helper:HtmlHelper *
action:Expression<Action<'TController>> *
method:FormMethod *
htmlAttributes:Object -> MvcForm when 'TController : Controller
JScript does not support generic types and methods.
Type Parameters
- TController
The type controller.
Parameters
- helper
Type: System.Web.Mvc.HtmlHelper
The helper.
- action
Type: System.Linq.Expressions.Expression<Action<TController>>
The action.
- method
Type: System.Web.Mvc.FormMethod
The method.
- htmlAttributes
Type: System.Object
The html attributes.
Return Value
Type: System.Web.Mvc.Html.MvcForm
An opening form tag.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type HtmlHelper. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.118) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.118).