how to make 1st field of dropdownlist empty

Posted by Srinu0411 under ASP.NET on 12/22/2009 | Views : 2742 | Status : [Member] | Replies : 3
how to make 1st field of dropdownlist empty or to keep select in first field.

kaja srinivas


Responses

Posted by: Abhi2434 on: 12/22/2009 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Why dont you use

this.dropdown.Items.Insert(0, "Select Item");
this.dripdown.SelectedIndex = 0;


Even if you dont apply SelectedIndex as 0, it will automatically set it by default.

This will add a new item to the dropdownlist with "Select Item" as text.

Cheers

www.abhisheksur.com

Srinu0411, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bubbly on: 1/11/2010 [Member] Bronze

Up
0
Down
Hello,

Rather than keeping it blank it would be good if you give a message there

this.dropdown.Items.Insert(0, "Select");



++
Thanks & Regards,
Deepika

Srinu0411, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 1/11/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Hmm...

I have told him just that ... :)

www.abhisheksur.com

Srinu0411, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response