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.

Answers


there is not such things as autoPostBack or onSelectedItemChanged events in asp.net mvc . these belong to asp.net 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

Checking toggle state of multiple buttons after toggling any of the buttons

jquery button twitter-bootstrap toggle

This is my first question and my coding skills are minimal so please bare with me.

Python's time.sleep - never waking up

python multithreading deadlock sleep

I think this is going to be one of those simple-when-you-see-it problems, but it has got me baffled.