This is a migrated thread and some comments may be shown as answers.

[Solved] Interesting..... I just don't like helpers

1 Answer 109 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Happy
Top achievements
Rank 1
Happy asked on 13 Aug 2009, 12:43 PM
I've been working on switching our application over to MVC and while overall I really like it, my biggest dislike for it is all the helpers, all the overloads, and laying out complex pages with complex controls. I look at your accordian and tab samples and that's exactly what I really hate about MVC. It just doesn't look intuitive. It's not easy to read. It's almost like going back to the classic asp days. Entry level developers don't grasp it.

Why not just generate a new set of mvc controls that don't use viewstate, events, etc. Or give your existing controls an mvcmode flag? This is what I've done initially. I wrapped jQueryGrid with my own custom control. I declare the grid in my page just like any other control. And I set the url. Clean html. No viewstate. I can even use it in an asp.net app. Isn't all this jquery stuff really just offloading the ui to the browser?

 And if people need to get data into a control or custom set properties, they can just put a <% control.DataSource=this.Model %> after the control declaration? After all, using the helper is the equivalent of putting inline code into the page. Why not just lay the page out like one normally would have and then put that inline code all at the bottom? Or just after each control?

IMO, the biggest issue with controls, after the quality of html they generate, is that you can't use <% %> in declaring them.

But you can't really beat the easy of editting and readability of a control laid out like xml vs mvc helper spaghetii code.

I really pray MS comes up with a better alternative to helpers. Maybe providing an option to delay the processing of controls until the very end so that we can use <% %>. If we could use <% %> inside control declarations, I'd bet that would change everything. Either that or provide a new set of tags, [% %] to get processed when the page is first constructed and the controls are built up.

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 13 Aug 2009, 01:15 PM
Hi Happy,

It seems using the extension methods of the HtmlHelper class is one of the biggest issues for ASP.NET developers who try to migrate to ASP.NET MVC. Indeed migration of existing WebForms applications to ASP.NET MVC is not trivial to say the least as most of the ASP.NET controls do not work in MVC.

Still I think using helpers has its merrits:
  1. They are strongly typed C# (of VB.NET) code and have strong intellisense and refactoring support. Renaming and refactoring HTML tags is not that well supported in Visual Studio as C# code is.
  2. Other view engines (NHaml, Spark) will not support server side controls. The helpers are the only alternative if the developer has chosen a different view engine.
  3. Mixing <% %> and server side control is hard if not impossible at times. This is due the way server side expressions are implemented by the ASP.NET page parser. I am not sure if this can be improved easily.

By the way have you tried RadControls for ASP.NET Ajax in MVC? They have that "MVC mode" and behave in a similar way you describe it - you can do <% RadGrid1.DataSource = Model %> etc. By doing this they do not rely on ViewState. Because of that some of the nice, codeless features do not work however.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Happy
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or