Asp.net mvc views and strongly typed viewdata

asp.net-mvcviews

I prefer strongly typed viewdata for my asp.net mvc views for various reasons and I actually preferred the Views with codebehinds as they were in the earlier asp.net mvc previews because the codehind was a natural place to define the poco viewdata class as they generally have a 1:1 relationship with the actual view.

Are there any way to have the codebehind in asp.net rtm views or is this not a good approach?

EDIT:
The only reason I would like to have codebehind is that I see the ViewData as a property of the view. If the view was a class then the ViewData was one of its properties and it feels un-natural to define this in a separate assembly.

Best Answer

After almost a year together with MVC I can confirm I have not needed code-behind for views even once. If you use code-behind you're likely still thinking WebForms. Drop it.

Views should be there to just display the model data. Simple decisions like what CSS class to apply can be performed directly in the view within server tags. More complex decisions should go to the controller or business logic.