Well, the easiest way is to make the helper yourself, itโs really not difficult, and you have full control over them, especially since you can reuse standard default calls, for example, for a simple group of Boostrap text fields that you might have:
public static class BootstrapHtmlHelper { public static MvcHtmlString TextboxGroupFor<TModel, TProperty>( this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, string title, string id, string placeholder) { StringBuilder sb = new StringBuilder(); sb.AppendLine("<div class=\"form-group\">"); sb.AppendLine("<label for=\"{0}\">{1}</label>", id, title); sb.AppendLine( htmlHelper.TextBoxFor( expression, new { @class = "form-control", @id = id, @placeholder = placeholder }) ); sb.AppendLine( htmlHelper.ValidationMessageFor( expression ); sb.AppendLine("</div>"); return new MvcHtmlString( sb.ToString() ); } }
Then you can add any parameters, check the correctness, add auxiliary fields, do any formatting, etc.
Then you can use it in your views:
@Html.TextboxGroupFor(x => x.FirstName, "First Name", "first-name-id", "Enter first name...")
Update:
Example for a drop-down list, just reuse ListBoxFor and pass in IEnumerable<SelectListItem> :
public static class BootstrapHtmlHelper { public static MvcHtmlString DropdownGroupFor<TModel, TProperty>( this HtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> list, string selectedValue, string title, string id) {
In view:
@Html.DropdownGroupFor( x => x.Country, Model.Countries.Select(x => new SelectListItem { Text = x.Name, Value = x.Id }));