Ryan LanciauxNew Media Mercenary

Are you a Control Freak?

March 24, 2009 by ryan

No Controls?
Since the very early ASP.NET MVC previews, the most common argument I've heard against using the framework is the lack of user controls. In my opinion, this is a mixed blessing, however, for some, this is a show stopper. What can you do to provide a rich user interface with the MVC framework, while not reinventing the wheel?

jQuery
Now you could go ahead and program a full fledged data grid or WYSIWYG editor, however, unless you have a bit of time to spare this is not the ideal solution. As most may realize, jQuery fits very nicely to fill in the gaps left by the absence of user controls. For the most part, the controls are not going to let you just drag-and-drop, type in a dataset and profit but a lot of the pain is kept to a minimum.

Examples
Ingrid

If you're looking for a data grid there are a number of options available pictured above is Ingrid. Flexigrid is another good one that people have used with the MVC framework, however, their site appears to be down at the moment.


Treeviews are available

Radio Buttons / Check Boxes

Check out the jQuery plugin database.

Getting Started
So, if you've decided you want to look more into using jQuery plugins -- a couple of tips that may make the transition a little easier:

  • Read up on what people using different languages are doing. I'm not saying that you should necessarily go out and learn Rails or CakePHP/CodeIgniter (although, it is beneficial). but at least look at the techniques that programmers from that realm of things are doing -- see how they are implementing their controls.

What tips do you have for creating robust user interfaces with the MVC framework?
kick it on DotNetKicks.com




Related posts

Comments

March 25. 2009 01:15

shiffert

The MVC framework is just what .Net needed. Asp.Net web forms are great at emulating the drag and drop ease of creating a winforms app, but the controls are too heavy, viewstate is just annoying, and too much is attempted "behind the scenes" forcing a developer into the webform construct.

Asp.Net MVC / Jquery is a great alternative providing clean urls, RESTful operations and total control of the UI while at the same time allowing for a rich plug-able back end. I have an app using MVC 1.0 scheduled to launch on May 22. I'll be sure to ping you when it's up.

shiffert

March 26. 2009 13:28

mgroves

To get valid HTML, I'm often skipping a lot of ASP.NET controls anyway, so this isn't a showstopper. I'd imagine that as MVC matures, there will be a lot more options for controls than there are now.

mgroves

March 26. 2009 17:32

nathan

I thought one of the big selling points of .Net was all the work that had been done for you already - eg the controls were already built for you.

MVC seems like too much extra effort if I now have to go rooting around a Jquery database to find a control to use.

nathan

March 27. 2009 04:27

Niki

I've just looked at the ingrid site. It's pretty amazing what they do with JScript. But still, from a DRY standpoint, I don't like the server-side code that's required on every page that contains a grid. And I don't see a way around that with MVC because paging and sorting has to be done server-side if you want it to be efficient.

And it gets even worse when we're not talking about 3rd-party controls but about home-made ones: Sure I could encapsulate (some) repetitive page logic inside a jscript client-side block, but:
- writing jscript is a lot harder than writing corresponding C#. (at least for me as a C#-programmer)
- testing jscript on N browsers is even harder
- the code for the "control" is effectively scattered around a jscript file, a view and a controller, instead of encapsulated in a user control
- user controls work even if the client has disabled jscript...

So yes, I guess I'm a control freak Wink

Niki

March 27. 2009 04:52

Danni

I've been playing with coolite (http://www.coolite.com) for quite some time - if you don't know already it's a ASP.NET control built on the ExtJS JavaScript Framework. Next version is supporting ASP.NET MVC (you can check the demo here http://mvc.coolite.com).

With coolite i don't think to use another control for my ASP.NET MVC app though Laughing

Danni

March 27. 2009 07:33

mrx

I dont think viewstate is annoying, u can compress and put in the session, its not a big deal. About MVC, i dont think lack of controls is a problem, we dont have them in J2EE either.

mrx

March 27. 2009 09:47

max

Flexigrid has it website moved to here FYI: http://www.flexigrid.info/

max

March 27. 2009 23:59

Brian

I too am not a jscript fan...primarly due to lack of debugger support. i HATE trying to debug jscript...and write once run in any browser...PLEASE! I will look to Silverlight for any rich client functionality. Yes, it's a pain to learn XAML, but it's so much more powerful than html/xthml bla bla bla.

Brian

March 28. 2009 00:02

ryan

@Brian: I agree cross browser support can be painful. You try Firebug ever?

ryan

September 5. 2009 00:20

Joel_

OOO... can't wait to try out some of these plugins...

Joel_

Comments are closed




© 2008 Ryan Lanciaux :: powered by BlogEngine.NET