I am using Bootstrap 3.5 with ASP.NET controls (Visual Studio 2022). I have an ASP.NET:TextBox in a Bootstrap column. While an HTML input tag spreads across the entire Bootstrap column, left to right, the ASP.NET:TextBox does not. It's width is greatly shorter than the the column width.
I am using codebehind to populate the page with a servertransfer from another page which works quite well with ASP.NET controls, so I don't want to use the the html tags.
How do I get the Bootstrap formatting to spread across the Bootstrap columns correctly with ASP.NET controls?
Yes, some code and an illustration would be great.
Here is the code I have for the page in question.
<formview id="ProviderEdit" runat="server">
<div class="form-group, form-horizontal">
<div class="row" runat="server">
<div class="col-md-1" style="padding-top:7px;">
<asp:label ID="lblProviderName" CssClass="control-label" Text="Provider Name" Visible="true" runat="server"></asp:label>
</div>
<div class="col-md-6" style="padding-top:7px;">
<asp:TextBox ID="txtProviderName" Font-Size="Large" Font-Bold="true" CssClass="form-control" runat="server" Visible="true" ReadOnly="true" AutoPostBack="false"></asp:TextBox>
<%-- Provider Name --%> <asp:label ID="lblAcctType" CssClass="control-label" Text="Acct Type" Visible="true" runat="server"></asp:label> <asp:TextBox ID="txtAcctType" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox> <asp:label ID="lblUpdate" CssClass="control-label" Text="Updated" Visible="true" runat="server"></asp:label> <asp:TextBox ID="txtUpdated" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox> <asp:label ID="lblAddress" CssClass="control-label" Text="Address" Visible="true" runat="server"></asp:label> <asp:TextBox ID="txtAddress" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox> <asp:label ID="lblCity" CssClass="control-label" Text="City" Visible="true" runat="server"></asp:label> <asp:TextBox ID="txtCity" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox> <asp:TextBox ID="txtState" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox> <asp:label ID="lblZip" CssClass="control-label" Text="Zip" Visible="true" runat="server"></asp:label> <asp:TextBox ID="txtZip" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox>
The result is this: (You can see that provider Name's textbox should fit the whole col-md-6 column width but doesn't)
Not all the code appeared in my edit as code. Here it is again.
<formview id="ProviderEdit" runat="server">
<div class="form-group, form-horizontal">
<div class="row" runat="server">
<div class="col-md-1" style="padding-top:7px;">
<asp:label ID="lblProviderName" CssClass="control-label" Text="Provider Name" Visible="true" runat="server"></asp:label>
</div>
<div class="col-md-6" style="padding-top:7px;">
<asp:TextBox ID="txtProviderName" style="width:100%" Font-Size="Large" Font-Bold="true" CssClass="form-control" runat="server" Visible="true" ReadOnly="true" AutoPostBack="false"></asp:TextBox>
</div>
<div class="col-md-1" style="padding-top:7px;">
<asp:label ID="lblAcctType" CssClass="control-label" Text="Acct Type" Visible="true" runat="server"></asp:label>
</div>
<div class="col-md-2" style="padding-top:7px;">
<asp:TextBox ID="txtAcctType" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox>
</div>
<div class="col-md-1" style="padding-top:7px;">
<asp:label ID="lblUpdate" CssClass="control-label" Text="Updated" Visible="true" runat="server"></asp:label>
</div>
<div class="col-md-1" style="padding-top:7px;">
<asp:TextBox ID="txtUpdated" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox>
</div>
</div>
<div class="row" runat="server">
<div class="col-md-1" style="padding-top:7px;">
<asp:label ID="lblAddress" CssClass="control-label" Text="Address" Visible="true" runat="server"></asp:label>
</div>
<div class="col-md-6" style="padding-top:7px;">
<asp:TextBox ID="txtAddress" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox>
</div>
<div class="col-md-1" style="padding-top:7px;">
<asp:label ID="lblCity" CssClass="control-label" Text="City" Visible="true" runat="server"></asp:label>
</div>
<div class="col-md-1" style="padding-top:7px;">
<asp:TextBox ID="txtCity" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox>
</div>
<div class="col-md-1" style="padding-top:7px;">
<asp:TextBox ID="txtState" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox>
</div>
<div class="col-md-1" style="padding-top:7px;">
<asp:label ID="lblZip" CssClass="control-label" Text="Zip" Visible="true" runat="server"></asp:label>
</div>
<div class="col-md-1" style="padding-top:7px;">
<asp:TextBox ID="txtZip" runat="server" Visible="true" CssClass="form-control" AutoPostBack="false"></asp:TextBox>
</div>
</div>
</div>
</formview>
Thank you for your quick response. I tried your suggestion of adding a width of 100% to the textbox but it doesn't stretch the TextBox like it does in your example when the textbox is in a table. You can see I added it in the code I have copied this second time. The result was identical to the first illustration I sent.


