Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to insert at first

Reply
Thread Tools

How to insert at first

 
 
ad
Guest
Posts: n/a
 
      06-17-2006
I have a dropdownlist, and it's Items is bound to a TableAdapter.
After the Dropdownlist bound, I want to add a items to the DropDownList's
Items, but it always at bottom.

How can I add the new items at the top?


 
Reply With Quote
 
 
 
 
Shawn
Guest
Posts: n/a
 
      06-17-2006
Like this:
myDropDownList.Items.Insert(0, "new value")



"ad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
I have a dropdownlist, and it's Items is bound to a TableAdapter.
After the Dropdownlist bound, I want to add a items to the DropDownList's
Items, but it always at bottom.

How can I add the new items at the top?



 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      06-17-2006
And if you want to give both text and value, then

myDropDownList.Items.Insert(0, New ListItem("text","value"))

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


"Shawn" <(E-Mail Removed)> wrote in message
news:e%(E-Mail Removed)...
> Like this:
> myDropDownList.Items.Insert(0, "new value")
>
>
>
> "ad" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> I have a dropdownlist, and it's Items is bound to a TableAdapter.
> After the Dropdownlist bound, I want to add a items to the DropDownList's
> Items, but it always at bottom.
>
> How can I add the new items at the top?
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Insert Multiple Records Using One Insert Statemen with MySQLdb module anton.ranieri.it@gmail.com Python 1 12-06-2008 12:47 PM
insert in std::map does not insert the object simon.elbaz@free.fr C++ 1 11-04-2007 11:42 PM
Insert & Insert/Repeat buttons in a detailsview eagle ASP .Net Datagrid Control 0 07-12-2007 12:47 PM
Detailsview loses insert mode contents when Insert fails... cannontrodder ASP .Net 1 07-25-2006 08:38 AM



Advertisments