DropDownList items disappearing after 2 postbacks

H

Howard Cheng

I have a page with a big chart/table on it. Users can click the
LinkButton headers in the table to sort by the values in that column.
A few of the columns have DropDownLists in the headers for filtering
purposes (i.e., pick a value from the list and only rows with that
value in that column will appear). Make sense so far?

The sorting LinkButtons all postback to one CommandEventHandler. The
DropDownLists all AutoPostBack to a single EventHandler. The
CommandArguments of the LinkButtons are hard-coded into the ASPX file.
The DropDownLists are also hard-coded into the ASPX file, but their
ListItems are dynamically added during Page_Load if it's not a
postback (values come from an XML file). The values being displayed
all come out of the same XML document, are put into a DataSet, and
then sorted/filtered depending on the user's choices. The DataSet is
then bound to a Repeater.

The problem I'm experiencing is that on the first postback AFTER a
sort operation, the DropDownLists lose all of their ListItems. In
other words, if I do two sort operations in a row, they empty. If I do
a filtering operation (i.e., get one of the DropDownLists to
AutoPostBack) then a sort, followed by another filter, then they
disappear. If I do mulitple filtering operations only, nothing
disappears.

I've run this through the VS.NET debugger and after the second
postback, the DropDownLists' Items.Count property is zero. No
explanation as to why all the ListItems disappear.

I have a sample and source code posted at
http://howard.zentropy.com/ct09.aspx. If anyone could PLEASE take a
look and tell me if I'm doing anything wrong, or even that it's a
known ASP.NET bug, that would be greatly appreciated. I've been
tackling this thing for two days now and am going seriously bonkers
trying to figure it out.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top