ASP.NET MVC application. I have a Html.DropDownList. I want to redirect to another controller when the selection is changed, and want the key of the selected dropdownlist item as a param in the URL.
How should I go about this?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll need to do this with Javascript; I would recommend using jquery. Also, put the dropdown in a form, method of get and action of the controller/action URL. Then set the click event to post the form.
So, your HTML will be something like:
And in jquery something like:
Note you can use the Html.Form() helper to create the form. Also, I’d recommend having a submit button on the form, which you can hide with javascript. Then people who have JS disabled still have a way to submit the form.