DmitryEfimenko / TwitterBootstrapMvc

Fluent implementation of ASP.NET-MVC HTML helpers for Twitter Bootstrap.
Apache License 2.0
221 stars 78 forks source link

Appending Multiple Textboxes all in one row #418

Open mletheren opened 8 years ago

mletheren commented 8 years ago

I am trying to design a quick control with TwitterBootsrapMVC that allows for faster data entry for a date of birth.

I nearly have the control working, but I am wondering if this is the best way to do it?

I want to have 3 text boxes appear on the same line, each one of a col-md-1 size.

Here is how I did it:

<div class="form-group">
        <label class="control-label col-lg-2">Date of Birth</label>
        <div class="col-lg-1">
            @Html.Bootstrap().TextBoxFor(m => m.BRC_RepliesRecord.nDOBYear).Placeholder("yyyy")
        </div>
        <div class="col-lg-1">
            @Html.Bootstrap().TextBoxFor(m => m.BRC_RepliesRecord.nDOBMonth).Prepend(Html.Label("/")).Placeholder("mm")
        </div>
        <div class="col-lg-1">
            @Html.Bootstrap().TextBoxFor(m => m.BRC_RepliesRecord.nDOBDay).Prepend(Html.Label("/")).Placeholder("dd")
        </div>
    </div>

Is there a better way?

DmitryEfimenko commented 8 years ago

There are different ways you could achieve the same goal. What you are doing is just fine in my opinion. However, take a look at this issue. The result of it was a new helper .Div(), which you might utilize as well as helper .CustomControls(). This comment might be particularly helpful. Also this StackOverflow answer might give you some additional ideas.