By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,702 Members | 1,432 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,702 IT Pros & Developers. It's quick & easy.

add a list item to a bound control?

P: n/a
Hi,

I have a drop down list thats bound to a SQL query. But I want to have
the top item or .SelectedItem to be a generic "Please Select..." with
no value. I've searched for the answer and tried every combination and
can't find an answer.

I've tried adding <ASP:ListItem> to the control but the bound data
overides it.

I'm using .NET with VB, Any suggestions?

Feb 14 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
jr***@blackstaronline.net wrote:
Hi,

I have a drop down list thats bound to a SQL query. But I want to have
the top item or .SelectedItem to be a generic "Please Select..." with
no value. I've searched for the answer and tried every combination and
can't find an answer.

I've tried adding <ASP:ListItem> to the control but the bound data
overides it.

I'm using .NET with VB, Any suggestions?


Don't bind the object to the SQL. Just loop through the sql and add the
items in yourself. That way you'll can add your item at the top.

Chris
Feb 14 '06 #2

P: n/a
Thanks Chris,

Actually I figured it out and it seems for this instance a little
easier than looping through the results. All I had to do was add this
one line after I bound the data to the control.

mydropdown.Items.Insert(0,New ListItem("Please Select...",""))

Feb 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.