Hi! I have a dropdown that is populated by a hashtable. THis part is working fine. But, I have to select an option in this dropdown according to information I get from a SQL Query.
It's like this:
The field in the table can have 0 - 3
0 First
1 Second
2 Third
3 Fourth
I need to display a drop down with all options, which I did through using a hashtable.
Hashtable ht = new Hashtable;
ht.Add("0", "First");
ht.Add("0", "Second");
ht.Add("0", "Third");
ht.Add("0", "Fourth");
lstPlace.DataSource = ht;
lstPlace.DataTextField = "value";
lstPlace.DataValueField = "key";
lstPlace.DataBind;
I was wondering how to have lstPlace now have a certain option selected according to info in the DB. I tried a SQLDataSource, but that didn't seem to work. I am really new to C# so any help would be appreciated. Or if I'm headed the wrong way, letting me know the correct patht would be appreciated, too.
Thanks,
D