K
KatMagic
How can I populate a drop down list with a blank entry so that it is the
first item in the list?
I tried:
ddl.Items.Add(New ListItem(" ", 0))
And then getting a dataset and binding it to the ddl, which of course loses
the blank item. If I run the above after binding the dataset, the blank
entry is at the end of the list. The problem with that is in several places
in my application, I select an item in the drop down list according to a
value. If the value is not found, it returns 0. If I select the drop down
list according to that 0, it displays the first item in the list, which is
incorrect. If I check for a 0 value, then select the blank entry if it's
zero, then the value that actually does point to the first item isn't found.
Hope that makes sense. Basically, my problem would be solved if I could add
a blank entry first.
first item in the list?
I tried:
ddl.Items.Add(New ListItem(" ", 0))
And then getting a dataset and binding it to the ddl, which of course loses
the blank item. If I run the above after binding the dataset, the blank
entry is at the end of the list. The problem with that is in several places
in my application, I select an item in the drop down list according to a
value. If the value is not found, it returns 0. If I select the drop down
list according to that 0, it displays the first item in the list, which is
incorrect. If I check for a 0 value, then select the blank entry if it's
zero, then the value that actually does point to the first item isn't found.
Hope that makes sense. Basically, my problem would be solved if I could add
a blank entry first.