Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I work on asp.net web forms . I face issue on design page print server drop down list and

branches drop down list not display on same line or rows

so How to make both drop down list on same line or rows by bootstrap or CSS.

What I have tried:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="TestPage.TestPage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    <title></title>
       <style>
        body
        {
            padding: 20px
        }
    </style>

</head>
<body>
      <script type="text/javascript" src='https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js'></script>
    <script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js'></script>
    <link rel="stylesheet" href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css'
        media="screen" />
    <form id="form1" runat="server">
        <div style="max-width: 400px;">
         <h2 class="form-signin-heading">Reprint ADC JDE Reports</h2>
         <div class="row">
             <div class='col-md-4'>
        <asp:Label ID="lblPrintServer" runat="server" Text="PrintServer"></asp:Label>
        <asp:DropDownList ID="dropPrinters" runat="server" CssClass="form-control"  AutoPostBack = "True" Width="200px" Height="32px">
        </asp:DropDownList>
                 </div>
             <div class='col-md-4'>
        <asp:Label ID="lblBranch" runat="server" Text="Branch"></asp:Label>
        <asp:DropDownList ID="dropBranches" runat="server" CssClass="form-control"  AutoPostBack = "True" Width="200px" Height="32px">
        </asp:DropDownList>
                 </div>
       
        
             </div>
            </div>
    </form>
</body>
</html>
Posted
Updated 30-Jan-23 22:03pm
Comments
Andre Oosthuizen 31-Jan-23 4:10am    
See the bootstrap solution at https://stackoverflow.com/questions/53099293/elements-on-same-line-in-bootstrap-column

1 solution

Take off the Width and Height from both lists.

The form-control class will set the list to 100% width; if you want the labels to display on the same line as the lists, you can't put then in the same container. Either split them out into separate columns, or add another container within the col-md-4 element.
ASP.NET
<div class="row">
    <div class='col-md-4'>
        <div style="display:flex;">
            <asp:Label ID="lblPrintServer" runat="server" Text="PrintServer"/>
            <asp:DropDownList ID="dropPrinters" runat="server" CssClass="form-control" AutoPostBack="True"/>
        </div>
    </div>
    <div class='col-md-4'>
        <div style="display:flex;">
            <asp:Label ID="lblBranch" runat="server" Text="Branch"/>
            <asp:DropDownList ID="dropBranches" runat="server" CssClass="form-control" AutoPostBack="True"/>
        </div>
    </div>
</div>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900