Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html.BeginForm() with GET method

Tags:

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

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

Here VS complains that best overload doesn't have a parameter method. Thank you!

like image 700
mishap Avatar asked Sep 23 '11 19:09

mishap


People also ask

What is HTML BeginForm ()?

BeginForm is the Html Helper Extension Method that is used for creating and rendering the form in HTML. This method makes your job easier in creating form. Here, is the method to create a form using Html. BeginForm extension method in ASP.NET MVC5. BeginForm("ActionMethod", "ControllerName","Get⁄Post Method")

Which two objects can you passed as a parameter to the HTML helper Dot BeginForm method?

In the "BeginForm()" method we passed an action name and controller name so that the action method will be called that handles the post data request.

What is difference between HTML BeginForm and Ajax BeginForm?

BeginForm() will create a form on the page that submits its values to the server as a synchronous HTTP request, refreshing the entire page in the process. Ajax. BeginForm() creates a form that submits its values using an asynchronous ajax request.


1 Answers

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

@using (Html.BeginForm("someAction", "someController", FormMethod.Get)) {     ... } 
like image 51
Darin Dimitrov Avatar answered Sep 22 '22 17:09

Darin Dimitrov