|
|
#1 |
|
Hyperactive Member
Join Date: Nov 06
Posts: 385
![]() |
If I write ...
Code:
<asp:ListItem Value="0">--Select Category --</asp:ListItem> To populate the drop-down list I am doing something like this to get the list items from a database: Code:
conn.Open()
reader = categoryComm.ExecuteReader()
categoryList.DataSource = reader
categoryList.DataValueField = "CategoryID"
categoryList.DataTextField = "Category"
categoryList.DataBind()
reader.Close()
How can I get the --Select Category-- option to stay there? Thanks for any help. |
|
|
|
|
|
#2 |
|
Invisible
Join Date: May 02
Posts: 13,261
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Drop down list option disappears
It has to be a part of the list that is returned by the data source.
-tg
__________________
How to Use Parameters * I don't respond to private requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.* * Got Eels in your Hovercraft? * * Your guide to The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft * *Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming. "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN MVP '06-'10
|
|
|
|
|
|
#3 |
|
Hyperactive Member
Join Date: Nov 06
Posts: 385
![]() |
Re: Drop down list option disappears
Thanks for your reply. But, hoping it wasn't true, I have been ferreting around and found that if you set AppendDataBoundItems to true - you can put your 'heading' category at the top and the data bound items appear beneath.
|
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|