troubleshooting Question

How to get a listbox selection to persist through a postback

Avatar of xfungalx
xfungalxFlag for United States of America asked on
ASP.NET
9 Comments1 Solution448 ViewsLast Modified:
Hello

I have a webform with a dropdown list bound to a sql datasource and a listbox bound to a second datasource using the dropdown box to modify what the listbox is populated with (does this make sense?).  Everything works great as far as correctly populating the dropdown and susequently, the listbox, however when a specific listbox item is chosen the form always shows the item at itemindex 0.

Here is how it works:

The page loads.  The user selects a category from a dropdown list.  Based on the category selected the listbox is populated with the appropriate pdf documents.  The user then selects a listbox item and clicks a "View Document" button.  The site then loads a popup window of the selected .pdf document.

The problem:

No matter what item is selected in the listbox, the item located at itemindex 0 is opened.  

* Enable ViewState is set to "True"
* Both datasources and both controls are configured within the IDE (VWD) and not coded in the code behind.  (Although I suspect the solution will have me hand coding all of this)

Please help with this, I have worked hard on this interface for this page and really like how it has turned out... it just doesn't quite work yet.

If there is any confusion regarding my description I can provide a hyperlink to the site itself.  Though since it does not work quite yet, I hesitate to do that unless someone thinks it would be helpful.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Computer101

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros