Author: Stephen Walther on ASP.NET MVC | Posted on: 8/13/2008 3:21:35 PM | Views : 1516

When you need to repopulate the form data in an edit form, displaying both valid and invalid values, use ViewData.Eval() to retrieve the values from both the view data dictionary and the view data Model. You use view data in an ASP.NET MVC application to pass data from a controller action to a view. You assign the view data to a controller’s ViewData property and you read the view data from a view’s ViewData property. The MVC ViewData class is a hybrid of two classes. On the one hand, the ViewData class inherits from the base Dictionary class (Dictionary<string,object>). Therefore, it works just like a standard generic Dictionary collection. You add a key and value pair to ViewData like this: ViewData[“message”...(read more) ...

Go to the complete details ...