Groups | Blog | Home
all groups > asp.net webcontrols > october 2003 >

asp.net webcontrols : Blank top row in ListBox



Mark Aurit
10/13/2003 2:38:40 PM
Im populating a drop down list box from a database, and Id
like the top row to be blank - or be populated with the
words " select from entries below ", or something along
those lines.
I suppose I could do this at the database level, but it
seems it would be cleaner if I could populate the control
and before rendering it insert the line at the top. There
is a prerender event for the list box, but Im having a
difficult time with this, and I was hoping someone else
had some ideas.
Can anyone help?
michmo NO[at]SPAM online.microsoft.com (
10/14/2003 9:24:00 PM
Hi,

After you load your drop list with data, you can then insert a row at the
top as follows:
DropDownList1.Items.Insert(0, "Select one")

Does that answer your question?

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.


--------------------
[quoted text, click to view]
AddThis Social Bookmark Button