Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 drop down list

Author  Topic 

jhermiz

3564 Posts

Posted - 2004-10-06 : 18:18:02
When I load a drop down list it automatically selects the first value
in the list. I tried doing this:

Me.ddlCustomers.SelectedIndex=-1

hoping it would make sure nothing is selected and that didnt work.
I just want to make sure the user selects something so that the combo box triggers the ChangeSelectedIndex event. Right now if it has a value it doesnt run that code.

I want the combo boxes to have nothing selected at first.

I tried searching google with very little info :(.

Thanks,

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-06 : 19:11:28
can you just set the text property of the combobox to "" ?

- Jeff
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-06 : 19:27:42
I think to do that, you have to add a "blank" item to the drop down, and test for blank everyplace. It sucks, but it works.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-10-06 : 20:55:20
Jeff I tried...there is no text property for a drop down list??? Or am I missing something...
Michael, you've got to be kidding me!

Someone tell me there has got to be a way to not have a value selected when a combo is loaded..cant I just get nothing :(
Good lord why o why me!!!!!!!!!!!
Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2004-10-07 : 12:52:01
Michael has the right answer. Then just add a requiredFieldValidator, and set the initialvalue to -1 (Or whatever the value of your blank item is)

-Chad

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-10-07 : 13:44:19
Jon
All knowing I am in all things ASP.net. In time, learn this, you will.

Michael :)


<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2004-10-08 : 14:38:19
Easy Michael,

Lots to learn have you young Padawan.

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page
   

- Advertisement -