Solved

dropdown list bounditem position.

Posted on 2009-05-07
2
221 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
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now