I have a form on my view and a corresponding submit button. The form is responsible for selecting options for some offers search. The homepage url looks as follows:
http://localhost/
when I click submit button, an appropriate controller’s action is called. However, I would like all form’s parameters to be exposed in the url (so there will be a possibility to share the link between 2 persons for instance and they will have the same results).
So for instance, how can I achieve (for instance) something like that:
http://localhost/?startDate=20120215&endDate=20120230&catalog=ISA
If you make the form’s method GET, all of the variables will be part of the query string.
You can use this overload to change the Form’s request type:
FormExtensions.BeginForm Method (HtmlHelper, String, String, FormMethod)
Or, if you’re using RedirectToAction, you can pass the parameters as an object:
Controller.RedirectToAction Method (String, Object)