View Single Post
Old May 25th, 2004, 03:24 PM
bmains bmains is offline
Friend of Wrox
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts


Sorry about the SelectedItem, I forgot about that. Anyways, another thing you can try is setting the DataValueField to either the city_id or the name property, and reference lstCity.SelectedValue = "value". Like you had said, that may be the problem.

It does assign an index value, starting at zero. So when you did lstCity.SelectedIndex = 4, it referenced the 5th item. You don't set the sequential values for DataTextField and DataValueField (although it may work; I don't know).

It seems straightforward to me... In addition, maybe you want to try to move the statement from the PreRender event to the Load event? Don't know if that will help.