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 7768297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:53:06+00:00 2026-06-01T15:53:06+00:00

I am currently working on a C# project using ASP.NET. And I’d like to

  • 0

I am currently working on a C# project using ASP.NET. And I’d like to implement a list of dropboxes. So a User starts with a dropbox and can select a method and next to the dropbox is a + and – button, which enables a user to add more dropboxes. So I am wondering how can I implement that is it possible to build a List of dropboxes in ASP.NET?

  • 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-06-01T15:53:07+00:00Added an answer on June 1, 2026 at 3:53 pm

    You don’t need any server side code for this, client side scripting is ideal solution for your needs.

    Having such HTML:

    <div id="MainPlaceholder">
        <div id="DropDownPlaceholder">
            <select name="myDropDown">
                <option value="1">First</option>
                <option value="2">Second</option>
                <option value="3">Third</option>
            </select>
            <button type="button" onclick="AddDropDown(this);">+</button>
            <button type="button" onclick="RemoveDropDown(this);">-</button>
        </div>
    </div>
    

    You need the following pure JavaScript to make it work:

    <script type="text/javascript">
    var added_counter = 0;
    
    function AddDropDown(sender) {
        var parent = sender.parentNode;
    
        //make fresh clone:
        var oClone = parent.cloneNode(true);
    
        //append to main placeholder:
        parent.parentNode.appendChild(oClone);
    
        //store change in global variable:
        added_counter++;
    }
    
    function RemoveDropDown(sender) {
        //don't allow to remove when there is only one left
        if (added_counter <= 0) {
            alert("One drop down must exist");
            return;
        }
    
        var parent = sender.parentNode;
    
        //disable so value won't be passed when form submitted:
        parent.getElementsByTagName("select")[0].disabled = true;
    
        //hide:
        parent.style.display = "none";
    
        //store change in global variable:
        added_counter--;    
    }
    </script>
    

    The code has comments, but if you need any further explanation please feel free to ask.

    Live test case.

    Edit: As you need to read the selected values on the server side code, better approach would be to change the name of each cloned drop down:

    var totalAddedCounter = 0;
    
    function AddDropDown(sender) {
        var parent = sender.parentNode;
    
        //make fresh clone:
        var oClone = parent.cloneNode(true);
    
        //assign unique name:
        oClone.getElementsByTagName("select")[0].name += "_" + totalAddedCounter;
    
        //append to main placeholder:
        parent.parentNode.appendChild(oClone);
    
        //store change in global variable:
        added_counter++;
        totalAddedCounter++;
    }
    

    Now the tricky part is reading those values. Instead of plain dropboxlistID.Text you will have to iterate over all posted values looking for what you need:

    foreach (string key in Request.Form.Keys)
    {
        if (key.StartsWith("dropboxlistID"))
        {
            string text = Request.Form[key];
            //.....
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I'm working on Web project that is built using ASP.NET Web Forms. We
I'm currently working on an ASP.NET project where I'm using the Google Maps API
I'm currently working on an ASP.NET MVC project using NHibernate and I need to
I'm currently working on an Intranet application project, using ASP.NET MVC 3. One of
I'm currently working on an ASP.NET 4.0 site using a project-less solution. By default
I am currently working on a multi branch desktop based project using VB.NET 2008.
I am currently working on an ASP.NET MVC2 project. This is the first time
I'm currently working on an ASP.NET 3.5 project, and I wanted to know your
Working on an ASP.NET 4.0 project, which uses user controls to dynamically generate a
I am currently working on a ASP.NET MVC 3 project in which I need

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.