Should I use HtmlHelper or roll my own controls?

I'm just beginning to learn ASP.NET MVC and I've run into a question. I'm trying to determine whether I should use HtmlHelper to create client controls or if I should just roll my own. My gut wants to lean towards just rolling my own because it gives me total control - and use jQuery to decorate and add cross-browswer functionality. But then I can see advantages of using HtmlHelper for various complex controls that may involve things like paging.

I'm looking for experiences about when it was better to use HtmlHelper and when it was better to roll your own.


The more they add to HtmlHelper the more I end up using them myself.

Take a look at these posts from ScottGu: MVC Preview 5 and MVC Beta

If you don't use the HtmlHelper versions of the input boxes, you won't get the nice, free validation.

Also, I'm not sure what prevents you from decorating the HtmlHelper controls with whatever you need to make them usable for jQuery.

You can add whatever attributes you need using the htmlAttributes overload like so:

<%= Html.TextBox("LastName", ViewData.Model.LastName, new { @class = "required" })%>

The interesting part for what I'm talking about is the anonymous object you see there (new { @class = "required" }).

You can put anything in there you'd need, and it gets slapped onto the attribute section of the control.

Good luck!

Need Your Help

Cannot properly centre nav bar (uses col-md-3) bootstrap css and html

html css twitter-bootstrap navbar centering

so basically I've got this code: HTML and CSS below, using bootstrap as well, and for some reason, it's not centred. It used to be, but at some point it wasn't anymore, now it pulls to the left. See

Query SPARQL to DBPedia using Java code

java rdf sparql dbpedia

I would like to get the URIs of the page on DBPedia that have a label equal to "London". That is, when I query DBPedia, if a page the property rdfs:label with the value "London", then I want to ge...