Making Bootstrap Even Easier, with MVC HTML Helpers

Inspired, more than a little, by a blog post over at, I decided that I could make my life with bootstrap even easier. I had the idea to create HTML Helpers for MVC that would enable the use of some of the display attributes to add more auto-magic goodness to the page.

My goal was to be able to simply use @Html.BootstrapTextBoxFor(m => m.description) in my markup, but the rendered output would include the bootstrap placeholder, and the title attribute would be set to allow for automatic tooltips on mouse over.

I decided that it would make a lot of sense, to use the “description” value of the display attribute for the tooltip, and the “prompt” value of the same attribute for the placeholder. So I started off — as I usually do — to see if anyone had already done this. Sure enough, I found the blog post, which gave me an incredible head start. The grunt work was already done, it was just assigning the additional properties. Here is the final result (feel free to compare to the original).

The result is exactly my desired result.




It was all very easy to implement, and extend even further and to other standard helpers, such as the textareafor helper.

Leave a Reply

Your email address will not be published. Required fields are marked *