ASP.NET MVC RC – Creating a MVC User Control with a codebehind

 

Questions


Trying to create a MVC User Control in the Release Candidate and I can’t see to make one with a codebehind file. The same is true for MVC View pages.

Creating Views in the Beta would produce codebehinds…am I missing something?

 

 

————————————————-

Answer

Code behind kind of defeats the purpose of the MVC Framework. Functionality should be kept separate from the view, the MVC team felt that code behind pages went against this ideology and therefore removed them.

Your can create a custom helper method to create your control. Also I’m not sure if MVC has view components (Monorail/Castle) but that could be an option as well.

asp.net-mvc,code-behind

Facebook Comments

Post a comment