Solved

textbox all on one line. mvc5 twitter bootstrap

Posted on 2014-03-28
5
1,693 Views
Last Modified: 2014-03-28
I'm trying to have the textbox for a phone number to be all on one line. I have it parsed out to three textbox. Right now every object drops to a new row. What am I doing wrong?

 <div class="form-group">
            @Html.LabelFor(model => model.Phone1, new { @class = "control-label col-md-3" })
            <div class="col-md-6">
                (@Html.TextBoxFor(model => model.Phone1, new { @class = "form-control input-large", maxlength = "3", @placeholder = "", style = "width:50px;" })) @Html.TextBoxFor(model => model.Phone2, new { @class = "form-control input-large", maxlength = "3", @placeholder = "", style = "width:50px;" }) @Html.TextBoxFor(model => model.Phone3, new { @class = "form-control input-large", maxlength = "4", @placeholder = "", style = "width:70px;" })
                @Html.ValidationMessageFor(model => model.Phone1)
            </div>
        </div>

Open in new window

0
Comment
Question by:NickMalloy
  • 2
  • 2
5 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39961796
I'd guess it's probably down to the markup being produced. Can you post a sample of the markup generated by your code?
0
 

Author Comment

by:NickMalloy
ID: 39961804
Here is the generated html

   <div class="form-group">
            <label class="control-label col-md-3" for="Phone1">Phone</label>
            <div class="col-md-6">
                (<input class="form-control input-large" data-val="true" data-val-required="Phone is required" id="Phone1" maxlength="3" name="Phone1" placeholder="" style="width:50px;" type="text" value="" />) <input class="form-control input-large" id="Phone2" maxlength="3" name="Phone2" placeholder="" style="width:50px;" type="text" value="" /> <input class="form-control input-large" id="Phone3" maxlength="4" name="Phone3" placeholder="" style="width:70px;" type="text" value="" />
                <span class="field-validation-valid" data-valmsg-for="Phone1" data-valmsg-replace="true"></span>
            </div>
        </div>

Open in new window

0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 300 total points
ID: 39961821
Can you post the styles associated with the various CSS classes you have in there too?
0
 

Author Comment

by:NickMalloy
ID: 39961913
i changed the form-control style from display block to inline. This was in the bootstrap styles.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39961918
http://jsfiddle.net/GaryC123/52VtD/4085/
   <div class="form-group">

            <div class="col-md-3">
                            <label class="control-label" for="Phone1">Phone</label>
                (<input class="form-control input-large" data-val="true" data-val-required="Phone is required" id="Phone1" maxlength="3" name="Phone1" placeholder="" style="width:50px;" type="text" value="" />)
                <input class="form-control input-large" id="Phone2" maxlength="3" name="Phone2" placeholder="" style="width:50px;" type="text" value="" /> 
                <input class="form-control input-large" id="Phone3" maxlength="4" name="Phone3" placeholder="" style="width:70px;" type="text" value="" />
          
                <span class="field-validation-valid" data-valmsg-for="Phone1" data-valmsg-replace="true"></span>
            
        </div>

Open in new window

.form-control {
    display:inline-block
}

Open in new window

0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.net Have sliders change in order 2 23
Regex validation 2 25
Save ms data to server side. 19 44
Linq asp.net mvc 13 10
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question