ListBox SelectedIndex problems
-
I'm building an application where I need the selected index of a ListBox set as AutoPostBack = true to be sent to the backend code for processing. However, on postback, the ListBox always reverts to SelectedIndex = -1, no matter what item I have chosen within the box; as a result, I can't use the selection. EnableViewState IS set to True. Anybody know a solution or workaround for this problem? Thanks for you help!
-
I'm building an application where I need the selected index of a ListBox set as AutoPostBack = true to be sent to the backend code for processing. However, on postback, the ListBox always reverts to SelectedIndex = -1, no matter what item I have chosen within the box; as a result, I can't use the selection. EnableViewState IS set to True. Anybody know a solution or workaround for this problem? Thanks for you help!
where are you setting the contents of the listbox? When a postback occurs everything in Page_Load is executed first, so make sure that is done in a
not Page.IsPostback
if statement. that caused a few problems for me when I first started with ASP.NET /jason -
where are you setting the contents of the listbox? When a postback occurs everything in Page_Load is executed first, so make sure that is done in a
not Page.IsPostback
if statement. that caused a few problems for me when I first started with ASP.NET /jason