I have a partial view that is strongly typed. I have a drop down inside that partial view. I have rendered that partial view on the view. I need to get the item that was selected on the dropdown on the form submit. How do I get it?
Any help is appreciated.
Thanks,
Naveen
Give that drop down a name attribute at render time. Then, in post Controller Action, make sure to have a string with the same name as a parameter. Binding is done automagically for you by the framework
For example, in your view, you’d have something like this:
Then in your controller’s post action:
P.S. same idea works even if you construct your list using just HTML. Set some breakpoints and try it out for yourself