Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 941187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:04:49+00:00 2026-05-15T22:04:49+00:00

I have a dropdownlist (asp.net) and when user change the selection from the dropdownlist

  • 0

I have a dropdownlist (asp.net) and when user change the selection from the dropdownlist it display respected div.

i need help in aligning the controls. and want to look like this:

DropdownListControl — > selected_div — > button

below is my soucr code….

<div  style="width: 880px; padding-top: 2px; border-bottom: none; 
            height: 28px;"> 
            <asp:Label ID="lblFilterResultsBy" runat="server" Text="Filter Results by:"></asp:Label> 

          <asp:DropDownList ID="ddlFilter" runat="server" Width="221px"> 
        <asp:ListItem Text="Select..." Value=""></asp:ListItem> 
        <asp:ListItem Text="Date" Value="DATE"></asp:ListItem> 
        <asp:ListItem Text="Subject" Value="SUBJECT"></asp:ListItem> 
        <asp:ListItem Text="Status" Value="STATUS"></asp:ListItem> 
    </asp:DropDownList>       


    <div id="divDateRangeSearch"> 
        <div style="float: left"> 
            <asp:Label ID="lblDateRange" runat="server" Text="Date Range"></asp:Label> 
            <br /> 
            <uc1:DatePicker ID="FromDate" runat="server"  /> 
            <uc1:DatePicker ID="ToDate" runat="server"  /> 
        </div> 
    </div> 


    <div id="divSearchSubject" > 
        <div style="float: left"> 
            <asp:Label ID="lblSubject" runat="server" Text="Subject"></asp:Label><br /> 
            <asp:TextBox ID="txtSubject" runat="server" Width="225px"></asp:TextBox> 
        </div> 
    </div>  


    <div id="divStatusSearch"> 
        <div style="float: left"> 
            <asp:Label ID="lblStatus" runat="server" Text="Status" ></asp:Label> 
            <br /> 
            <asp:DropDownList ID="ddStatus" runat="server" Width="152px" > 
            </asp:DropDownList> 
        </div> 
    </div> 
</div>


        <asp:Button ID="btnSearch" Text="Search" runat="server" />  

UPDATE:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

   <style type="text/css">


#main {
  width: 800px;    
}

#select {
  float: left;   
  width: 250px;
  border: 1px solid blue ; 
}    

#holder {
  position: relative;
  width: 300px;
  float: left;
  margin-left: 20px;
  border: 1px solid red ; 
}

#div_date, #div_subject, #div_status {
  position: absolute;
  top: 0;
  left: 0;
}

#button {
  float: left;
  margin-left:20px
}   
</style>

</head>
<body>
    <form id="form1" runat="server">



    <script type="text/javascript">

        $(document).ready(function () {

            $('#filterResultsBy').change(function () {
                var sel = $(this).val();

                $('#div_date').hide();
                $('#div_subject').hide();
                $('#div_status').hide();

                if (sel === 'Date') {
                    $('#div_date').show();
                }
                else if (sel == 'Subject') {
                    $('#div_subject').show();
                } 
                else if (sel == 'Status') {
                    $('#div_status').show();
                }
            });

        }); 

    </script>

    <div id="main"> 
       <div id="select">
            Filter Results by:
            <select id="filterResultsBy">
                <option value="">Select...</option>
                <option value="Date">Date</option>
                <option value="Subject">Subject</option>
                <option value="Status">Status</option>
            </select>
            </div>
              <div id="holder">
            <div id="div_date" style="width: 250px; display: none;" >
                Date Range: 
                 <asp:textbox width="50px" id="startdate" runat="server" /> - to -  <asp:textbox width="50px"  id="enddate" runat="server" />
            </div>

            <div id="div_subject" style="display: none;" >
                Subject: 
                <asp:TextBox ID="txtSubject" runat="server" Width="225px" ></asp:TextBox>
            </div>

                               <div id="div_status" style="display: none;" >
                Status: 
                <asp:DropDownList    ID="ddlStatus" runat="server" Width="152px">
                </asp:DropDownList>

        </div>
              </div>

               <asp:Button ID="btnSearch" Text="Search" runat="server"   />
    </div>

    </form>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:04:50+00:00Added an answer on May 15, 2026 at 10:04 pm

    Sure, not a problem. You can clean up your markup a bit on the div’s that appear by removing the nested <div style="float: left">. The CSS would be as follows:

    select {
        float: left;
    }
    
    #divDateRangeSearch, #divSearchSubject, #divStatusSearch, #btnSearch {
        float: left;
        margin-left: 20px; /* put some space between the elements */
    }
    

    The above assumes that you’re creating and destroying the respected <div>‘s as you hide and show them. If you need them to all exist in the source and you’ll show and hide them, you’ll need something like the following:

    #divHolder {
        position: relative;
        float: left; 
        width: 200px; /* adjust as needed */
    }
    
    #divDateRangeSearch, #divSearchSubject, #divStatusSearch {
        position: absolute;
        top: 0;
        left: 0;        
    }
    

    And the HTML:

    <div id="divHolder">
        <!-- Markup for the 3 divs would go in here -->
    </div>
    <asp:Button ID="btnSearch" Text="Search" runat="server" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dropdownlist (asp.net) and when user change the selection and i want
I have an ASP.NET DropDownList control that retrieves the first and last name from
I have asp:DropDownList control which i want to display data to user who don't
i have a dropdownlist and a listbox both asp.net controls i am trying to
I have a asp.net 2.0 web site with numerous asp:DropDownList controls. The DropDownList control
I'm writing an ASP.Net webform with some DropDownList controls on it. Then user changes
i have a dropdownlist control in asp.net which resides in a user control .The
I am using Asp.net dropdownlist in one of my form ..I have two dropdown
I have an ASP.NET webform on which I use a DropDownList control to allow
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.