开发者

Html.BeginForm() with GET method

开发者 https://www.devze.com 2023-04-06 21:09 出处:网络
How can I specify that my form should be using GET method with @Html.BeginForm() ? @using (Html.BeginForm(method: FormMethod.Get))

How can I specify that my form should be using GET method with @Html.BeginForm() ?

@using (Html.BeginForm(method: FormMethod.Get))

Here VS complains th开发者_Go百科at best overload doesn't have a parameter method. Thank you!


There is an overload that allows you to specify the method:

@using (Html.BeginForm("someAction", "someController", FormMethod.Get))
{
    ...
}


Decorate the controller's action method with [HttpGet]. This is the controller action that this form will submit to.

0

精彩评论

暂无评论...
验证码 换一张
取 消