471,089 Members | 1,293 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

"choose one" in a dropdownlist

I have a databound drop down list. What is the easiest way to put the 1st
item as "choose one"?

Thanks.
Jun 27 '08 #1
5 1137
On Jun 4, 4:47*pm, "Cirene" <cir...@nowhere.comwrote:
I have a databound drop down list. *What is the easiest way to put the 1st
item as "choose one"?

Thanks.
if u did not complete it yet.set the selectedindex property to the 1.
Jun 27 '08 #2
"Cirene" <ci****@nowhere.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>I have a databound drop down list. What is the easiest way to put the 1st
item as "choose one"?
MyDDL.Items.Insert(0, new ListItem("Choose one", ""));
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #3
<asp:dropdownlist ... AppendDataBoundItems="true" ..>
<asp:ListItem Text="choose one" Value="-1" />
</asp:dropdownlist>

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <ci****@nowhere.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>I have a databound drop down list. What is the easiest way to put the 1st
item as "choose one"?

Thanks.

Jun 27 '08 #4
another possibility is in sql server, something like

select field01, field02 from tablename union '<< Chose One>>' as aa, -1 as
bb from tablename

and then .bind in codebehind etc.

John Bickmore
www.MyReader.net
"Cirene" <ci****@nowhere.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>I have a databound drop down list. What is the easiest way to put the 1st
item as "choose one"?

Thanks.

Jun 27 '08 #5
thanks everyone !

all great advice!

"xzzy" <mr********@comcast.netwrote in message
news:BO******************************@comcast.com. ..
another possibility is in sql server, something like

select field01, field02 from tablename union '<< Chose One>>' as aa, -1 as
bb from tablename

and then .bind in codebehind etc.

John Bickmore
www.MyReader.net
"Cirene" <ci****@nowhere.comwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>>I have a databound drop down list. What is the easiest way to put the 1st
item as "choose one"?

Thanks.


Jun 27 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by chris yoker via DotNetMonster.com | last post: by
1 post views Thread by chris yoker via DotNetMonster.com | last post: by
reply views Thread by guido_brasletti | last post: by
1 post views Thread by =?Utf-8?B?TWFyayBIb2xsYW5kZXI=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.