working with MVC Extensions (like DevExpress,Telerik...)

Feb 6, 2013 at 8:03 PM
Edited Feb 6, 2013 at 8:03 PM
hi,

I was looking to integrate with DevExress & Telerik and wanted to discuss my aproach. It seems that right now, the View is very dumb (which I like). However, MVC extensions live in a View - and if I want to use them, the View must become smarter and the Model must become dumber. There's a possibility of creating a View context inside the controller/Model, but this is a hack, and I suspect not what MVC was designed for.

So I am going to have the View take over most of the logic that is now inside Form.RenderHtml(); it will loop through each control and render them individually. I can create a Field called 'MVCExtension' - this thing will store only configuration options (like ID, etc) for the MVC Extension I am going to use. Now the View will do something like:
foreach(var ctrl in Model.Controls)
{
       if(ctrl.IsMVCExtension)
                 Html.RenderExtension(ctrl);
      else
         ctrl.RenderHtml();
}
Here I check if I'm rendering an MVC Extension, and if so, I send the configuration values to an Html helper that will have a giant case statement that will pick which MVC Extension to use based on the configuration - if I'm not an MVC Extension , I call the standard RenderHTml().

Do you have any feedback on this approach?

Thanks again ronnie!

Drew
Feb 7, 2013 at 1:58 AM
If it works and you have no problem sleeping at night, then go for it.
Feb 7, 2013 at 8:28 PM
thanks!