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

I need to correct my previous statement:

Where I said, "...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()."

This is incorrect. It DOES work, and works correctly for both the listbox loaded through the databind() and programmatically with Items.Add().

The original code for the Page_PreRender() function still does not work for the the listbox loaded using the databind().

The listbox seems to automatically assign an index value for each of the items within the listbox. This would explain why "lstCity.SelectedIndex = 4" works.

Am I missing a namespace? It seems like this should be pretty straight-forward.

Thanks for listening to my ramblings.