Server Controls and MVC

I've been lead to believe, without research, that server controls are forfeited in the MVC model. I am both very curious to know if this is true, and if so, how would one achieve something equivalent to a Repeater control, or any other view whose exact structure depends on the content of the model?

Answers


I disagree, Yuriy, that controls aren't useful. A set of data-bound MVC controls, easily bound to viewdata, sans obstinate ID rewriting, with no reliance on nasty viewstate or postback gunk and complete control over templating (defaulting to sensible markup), would be an excellent addition to the MVC framework. Controls are a very powerful and useful concept which can significantly increase development time, and shouldn't be discarded solely because they carry some emotional baggage from the ugly old webforms days! :)


ASP.NET MVC does not support ViewState nor postbacks so all asp.net controls relying on that will not work. The repeater control is one of the few that doesn't need it so it does work though.

The mvc equivalent of control is the HtmlHelper classes which generate html for you. The collection of htmlhelpers is quite large but you will not automatically find equivalents to the regular webforms controls because of the different nature of webforms and asp.net mvc.

MVCContrib is the contrib project for asp.net mvc so you will also find more htmlhelpers there http://www.codeplex.com/MVCContrib

It is also quite easy to roll your own htmlhelper methods

A good starting point for ASP.NET MVC is found here http://www.asp.net/mvc/


Correct, rails-like MVC doesn't fully support server-side controls with all their messy viewstates etc... You CAN use some of them but shouldn't really even bother. You can reuse UI portions by utilizing view components and maybe use some nice client-side widgets from jQuery UI or Yahoo UI to build rich grids, etc... As for the repeater... "foreach" is your friend :)


Need Your Help

How to do a summation only within specific cells via VBA

excel vba excel-vba target

In reference to the picture below, I would like to loop through a certain column (Column D in this case) until I hit a specific cell (Yellow cells in this case). In my final spreadsheet I have mult...

BlueJ Error: Non-static method(OOPoint) cannot be referenced from a static context

java oop static bluej

I'm a beginner java programmer; that is, I have no idea on the terms and stuff. Please refrain from using those programming terms, or at least define them in a way a clueless like me would comprehe...