Link to home
Create AccountLog in
Avatar of ToString1
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
ASKER CERTIFIED SOLUTION
Avatar of khan_webguru
khan_webguru
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Or you can look into this

http://www.isolutionteam.co.uk/asp-net-mvc-dropdown-selected-value/

Thats all from my side thanks
Avatar of ToString1
ToString1

ASKER

OK thanks I will have a look.