In MVC, When the view initially loads, I do not get the error. Only after post back , it is giving "There is no ViewData item with the key ..."
views:
18answers:
3
+3
A:
when you do a postback, you have to add the ViewData["key"]
again in the method that lives under [HttpPost]
Stefanvds
2010-09-24 10:20:42
A:
Set a breakpoint at the first point in your View where you access ViewData. You should be able to set a breakpoint inside <% %>
Compare values on load and on postback, see which key is missing.
Make sure you add this key in the POST accepting method.
Kindness,
Dan
Daniel Elliott
2010-09-24 10:21:31
A:
On the method that receives the post, you need to send all the data to the view again.
This includes not only what you set in ViewData, but the (view) model if the view uses one.
eglasius
2010-09-24 17:04:04