views:

2762

answers:

4
  1. Will using MVC enabled Telerik controls with ASP.NET MVC violate the MVC model?

  2. And if not, what kind of performance hit (versus features and development speed) will there be with using Telerik controls over manually coding the HTML?

A: 

I'm pretty sure that these rely on the PostBack model in WebForms and wouldn't be compatible with MVC views. You could probably find a way for them to work, but it wouldn't be in keeping with the MVC principles. You can mix/match WebForms with MVC Views in the same web site if needed, but I wouldn't recommend it.

What you will lose by using the Telerik controls are most of the benefits of MVC: clear separation of concerns, enhanced testability, leaner HTML, a cleaner architecture. It wouldn't surprise me to find that eventually Telerik comes out with controls for MVC. For now, I'd look at either pure Javascript implementations for client-side or hand-coded ViewUserControls if you need to reuse some common components.

tvanfosson
http://demos.telerik.com/mvchttp://blogs.telerik.com/AtanasKorchev/Posts/08-11-06/ASP_NET_Ajax_Controls_in_ASP_NET_MVC.aspx
EdenMachine
So yes you can get them to work, but they're really broken, if you want them to actually work (i.e., more than just do layout) you'll have to use WebForms which breaks MVC, and they'll come out with some MVC controls in the future. Isn't that what I said?
tvanfosson
Well, you basically just told me that postback and viewstate wouldn't work (which I already knew so I clarified my post question). My question point is do the Telerik controls (in their MVC-focused/"broken"-state) violate MVC and if not, what's the performance hit vs verbose HTMLHelpers or JQuery?
EdenMachine
If you are just using the control for layout and client-side functionality, I don't see how this would break MVC. The thing that would be breaking is if you needed to do set up in the codebehind for the control to work. If you're not doing this, you should be ok.
tvanfosson
+11  A: 

Since I am the person who built that demo I think I can share my opinion as well. This sample application does not violate the MVC principles according to me. RadControls do not rely on ViewState or postbacks in MVC applications (you can check the generated output to see for yourself - no __doPostBack or __VIEWSTATE). Indeed you need to write some code to bind the grid or populate the menu - but still the code is in the View (ASPX) and is entirely related with the presentation (again this is just my opinion so I might be wrong).

I should also mention that there are some limitations indeed - some of the built-in features (that rely on postback) do not work in MVC. However will work on resolving them. Feel free to open a support ticket or forum thread should you have any particular questions with regards to RadControls and ASP.NET MVC.

korchev
thanks! Done: "Thank you for submitting your inquiry to the Telerik Support. Your ticket ID is : 189098 For reference, please use this number when communicating with the Telerik support about this inquiry."
EdenMachine
A: 

Personally, I wouldn't use the current telerik controls with MVC. I think they work in some situations (http://telerikwatch.com/2009/01/telerik-mvc-demo-app-now-available.html), but I think they are quite viewstate / postback centric. Knowing telerik, they will come out with a MVC compatible version, but looks like they have a lot of work in front of them...

Keltex
+2  A: 

To your second question, regarding performance hit vs. manual coding, I think it depends on the control you're using. For example, if you use any of the Telerik navigation controls in MVC- such as Menu, TabStrip, or PanelBar- you'll save yourself a TON of manual coding (since a menu/tabstrip/etc. requires a lot of client-side code to provide the interactive features (like drop down options) and a lot of complex CSS). So, the RadControls in MVC will help restore the -productivity- you're used to when building rich ASPNET apps.

For more complex controls, like the Grid, which depend a lot on postbacks, you're mainly benefitting from the provided styling. To fit the MVC model, controls like the Grid require quite a bit of "custom" coding to "convert" postback events to URL actions, so you may not save a lot of code vs. a MVC grid template. You -will- save a lot of time on styling, though, and the performance difference should be negligble.

Hope that helps.

-Todd

Todd