You could do it like this:
@Html.TextBox("SearchString", null, new {@class="form-control"})
If you want to append the button to your textbox?
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
<input type="text" class="form-control" placeholder="Search for...">
</div>
http://getbootstrap.com/components/#input-groups-buttons
You replace your <input>
with @Html.TextBox("SearchString", null, new {@class="form-control"})
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
@Html.TextBox("SearchString", null, new {@class="form-control"})
</div>
WITH HTML Helper:
If you want a HTML Helper for Bootstrap TextBox your could do something like this:
public static class MyHtmlHelpers
{
public static MvcHtmlString BootStrapTextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> helper,
Expression<Func<TModel, TProperty>> expression)
{
return helper.TextBoxFor(expression, new { @class = "form-control" });
}
}
And then use like this:
@Html.BootStrapTextBoxFor(model => model.FirstName)