View Single Post
Old May 25th, 2004, 02:26 PM
nyclimber nyclimber is offline
Registered User
Join Date: May 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for the suggestion, but I think 'SelectedItem' is a read-only property and therefore could not be set.

A recent note, even if I change the one line of code in the Page_PreRender() function to:

     lstCity.SelectedIndex = 4

(this will explicitly tell the listbox to display the fourth element in the listbox)

It still will not work correctly for a listbox loaded with a databind(), but will for the listbox loaded programmatically with Items.Add().

Question: Do I need to explicitly set sequential values for:

     lstCity.DataTextValue = <Index (ie. 1,2,3...>

Could it be that I am unable to set the listbox to display a specified default city is because there is no value associated with the DataTextField assigned in the bind?

I'll look into that next. Any suggestions would be helpful?

Thanks again.