ToString1
asked on
mvc dropdown list not retaining selected value
I am binding an MVC dropodown and filtering a list from the selected value of dropdown.
However the selected value is not being retained on postback.
I have an index view and the controller initially loads a full list. I then have an index "post" method
that takes the selected ID from dropdown to filter the list.
The dropdown list is wrapped inside a form post tag like this
<% using (Html.BeginForm("Index", "customers", FormMethod.Post, null))
Is this the correct approach? I am sure it is something to do with postback
However the selected value is not being retained on postback.
I have an index view and the controller initially loads a full list. I then have an index "post" method
that takes the selected ID from dropdown to filter the list.
The dropdown list is wrapped inside a form post tag like this
<% using (Html.BeginForm("Index", "customers", FormMethod.Post, null))
Is this the correct approach? I am sure it is something to do with postback
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Or you can look into this
http://www.isolutionteam.co.uk/asp-net-mvc-dropdown-selected-value/
Thats all from my side thanks
http://www.isolutionteam.co.uk/asp-net-mvc-dropdown-selected-value/
Thats all from my side thanks
ASKER
OK thanks I will have a look.
http://stackoverflow.com/questions/2167705/problem-with-asp-net-mvc-dropdownlist-not-displaying-selected-value