Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
344 Points
136 Posts
MVP
Sep 16, 2008 11:40 AM|LINK
I think both fail because there is no ViewData["Targets"] created in you action.
If the action is the code you wrote in the first message, you wrote viewdata.Targets which doesn't exist (actually it should even not compile).
In order to make it work you need two elements in the ViewData:
ViewData["Targets"] which contains the list of items.
ViewData["Target"] which contain the selected item.
If this doesn't solve the problem, can you please post the full action?
Simo
simonech
Member
344 Points
136 Posts
MVP
Re: DropDownList ... What am I doing wrong?
Sep 16, 2008 11:40 AM|LINK
I think both fail because there is no ViewData["Targets"] created in you action.
If the action is the code you wrote in the first message, you wrote viewdata.Targets which doesn't exist (actually it should even not compile).
In order to make it work you need two elements in the ViewData:
ViewData["Targets"] which contains the list of items.
ViewData["Target"] which contain the selected item.
If this doesn't solve the problem, can you please post the full action?
Simo