Show different outputs when dropdownlist selection changes

I have a ViewModel with a List<Mouse>. In my view, binded with that viewmodel, I have a dropdownlist with mouse ids. When the user selects an item from the list, I have to change the information displayed on the page in a lot of textboxes (showing mouse information). How can I do this?(Using controller/razor/..?)

I've tried with

@Html.DropDownList(mouseList, new { AutoPostBack = "true",OnSelectedIndexChanged="GarantiDropDown_Change" })

and inserting method in controller but it does not work.


there is not such things as autoPostBack or onSelectedItemChanged events in mvc . these belong to WebForms . in order to do what you want , you should use javascript .

something like this :

@Html.DropDownList(mouseList, new { onchange = "this.form.submit();" })

and in the controller add an action to recieve the form data.

check these questions + , + , +:

Need Your Help

Translate xml string to Python list

python xml django string list

I am new to Python. I want to show this XML string as a list in a template.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.