Solved

dropdown list bounditem position.

Posted on 2009-05-07
2
227 Views
Last Modified: 2013-12-17
I have a dropdown list which is populated by a dataset and also one bounditem called 'Other'.

At the moment the bound item appears at the top of the dropdown list. Is it possible to put this item at the bottom of the dropdown list.

Thanks

I am using c# and asp,net
0
Comment
Question by:Mr_Shaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
PierreBeukes earned 500 total points
ID: 24323867
Hi,

There is a whole couple of ways you could do this.

- You can add the "OTHER" manually after the databind()
- You can alter the dataset and add the other to that.

See my example below how I add 4 rows and then add a 5th in the middle.
        DropDownList1.Items.Clear();
 
        ListItem lst = new ListItem();
        lst.Value = "1";
        lst.Text = "ONE";
 
        DropDownList1.Items.Add(lst);
 
        lst = new ListItem();
        lst.Value = "2";
        lst.Text = "TWO";
 
        DropDownList1.Items.Add(lst);
 
        lst = new ListItem();
        lst.Value = "3";
        lst.Text = "THREE";
 
        DropDownList1.Items.Add(lst);
 
        lst = new ListItem();
        lst.Value = "4";
        lst.Text = "FOUR";
 
        DropDownList1.Items.Add(lst);
 
        lst = new ListItem();
        lst.Value = "5";
        lst.Text = "FIVE";
 
        DropDownList1.Items.Insert(2, lst);

Open in new window

0
 

Author Closing Comment

by:Mr_Shaw
ID: 31578908
Spot on.. thanks
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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