Adrian Grigore

Archive for April, 2009|Monthly archive page

ASP.NET MVC Tip #1: Using Custom ViewModels with POST action methods

In ASP.NET MVC, LINQ on April 18, 2009 at 13:44

One of the top good practices for ASP.NET MVC is not to use the ViewData Dictionary, but to put your data in a strongly typed ViewModel instead. Many people seem to be using Linq to SQL entities as a ViewModel, because it’s a very comfortable approach. But what do you do if your view should contain data that is not included in any of your linq entities? Scott Gu’s chapter 1 preview of his upcoming ASP.NET MVC book recommends using a custom-shaped ViewModel for those cases. Read the rest of this entry »