H
Harvey Schmidlapp
I have a fairly complex form (generated by means of an ASP 3 page).
The form is used to define a query against a database. After running a
query, the user hits their browser's back button and goes back to the
form, where their selections show up. They can change whatever they
want to change and resubmit the new query. Mostly, everything works
fine, with radio buttons, selection lists, check boxes all coming back
in the state they were in before form submission.
Now, however, I have a problem. I'm working on adding a new selection
portion for the form. There are actually four different selection
lists that we want to make available to the user. The first, which is
the default when the form first loads, has about 400 items and loads
in a reasonable amount of time (i.e. a couple seconds). The second,
third, and fourth lists are considerably longer with the third being
the longest -- 15,000 or so entries which takes almost a minute to
load. Yes, I know, that's not ideal but this is what the client wants
so its what the client gets. Since the short, quickly loaded list is
the default, they only wait for the longer lists if and when they
choose them, it's not really too bad. So, they specify that they want
one of the longer lists and click a button to load that list. Instead
of rebuilding the whole page (as it did until now), I use an AJAX call
to refresh just that portion of the page. It works pretty well (if I
do say so myself).
Once the user has the list they want (whether the default, short list
or one of the longer ones), they can select one or more items in the
list and either click an arrow button or they can double click items
in the list. Either way, this moves the items from the list into an
initially empty list to the right of it. If that doesn't make sense,
it's something along the lines of this, although I wrote the code
before I found this one - http://www.codeproject.com/KB/webforms/DblPanePickList.aspx.
However many items are moved to the box on the right when the form is
submitted, they are all used in the query. That much is working great.
Now the problem. When you finish looking at the results of your query,
you click your browser's back button and return to the page where you
define the query. Everything that you selected is selected, as before,
with the exception of these two lists. The list on the right is empty
and the list on the left has nothing selected. I've been messing
around with every way I could think of to get it to repopulate them
correctly. The solution I finally came up with works beautifully in
Firefox but not at all in Internet Explorer (version 6, anyway, that's
all I've tested so far and it's what the client uses so if I fix it
there, I'm 95% done).
What I have done is on the results page, save the list of items
submitted to a session variable. When I go back, I read that session
variable and use the list to populate the selection boxes properly. In
Firefox, this works. In IE, it always loads the correct list but never
sees that the session variable has been changed. If I manually refresh
the page, of course, it loads correctly that time. If I change the
items select, I submit the query, wait for it, go back to the
definition page and once again, it doesn't remember the new values. I
assume this has to do with IE loading that page completely from cache
no matter what I ask it to do. Actually, Firefox did this at first.
Then I had the code that the AJAX calls get the session variable and
pass it back in the XML. That fixed it in Firefox but IE doesn't even
seem to request that code.
I'm not sure if I've explained the problem very well so please ask
questions. I wish I could give you a link to the site but I can't (as
the client would have a cow). If necessary, I could probably produce a
much abbreviated version that just has enough to demonstrate the
problem but it would take a good bit of time so would rather not if I
don't have to.
I'm open to any suggestions. Actually, I'm considering going back to
the drawing board and eliminating the AJAX portion of the code and
rebuild the entire page each time the user changes the list because of
this. I'd rather not, but then, I need it to work. Not that I'm even
sure it would work then. Thanks for any help you can provide.
The form is used to define a query against a database. After running a
query, the user hits their browser's back button and goes back to the
form, where their selections show up. They can change whatever they
want to change and resubmit the new query. Mostly, everything works
fine, with radio buttons, selection lists, check boxes all coming back
in the state they were in before form submission.
Now, however, I have a problem. I'm working on adding a new selection
portion for the form. There are actually four different selection
lists that we want to make available to the user. The first, which is
the default when the form first loads, has about 400 items and loads
in a reasonable amount of time (i.e. a couple seconds). The second,
third, and fourth lists are considerably longer with the third being
the longest -- 15,000 or so entries which takes almost a minute to
load. Yes, I know, that's not ideal but this is what the client wants
so its what the client gets. Since the short, quickly loaded list is
the default, they only wait for the longer lists if and when they
choose them, it's not really too bad. So, they specify that they want
one of the longer lists and click a button to load that list. Instead
of rebuilding the whole page (as it did until now), I use an AJAX call
to refresh just that portion of the page. It works pretty well (if I
do say so myself).
Once the user has the list they want (whether the default, short list
or one of the longer ones), they can select one or more items in the
list and either click an arrow button or they can double click items
in the list. Either way, this moves the items from the list into an
initially empty list to the right of it. If that doesn't make sense,
it's something along the lines of this, although I wrote the code
before I found this one - http://www.codeproject.com/KB/webforms/DblPanePickList.aspx.
However many items are moved to the box on the right when the form is
submitted, they are all used in the query. That much is working great.
Now the problem. When you finish looking at the results of your query,
you click your browser's back button and return to the page where you
define the query. Everything that you selected is selected, as before,
with the exception of these two lists. The list on the right is empty
and the list on the left has nothing selected. I've been messing
around with every way I could think of to get it to repopulate them
correctly. The solution I finally came up with works beautifully in
Firefox but not at all in Internet Explorer (version 6, anyway, that's
all I've tested so far and it's what the client uses so if I fix it
there, I'm 95% done).
What I have done is on the results page, save the list of items
submitted to a session variable. When I go back, I read that session
variable and use the list to populate the selection boxes properly. In
Firefox, this works. In IE, it always loads the correct list but never
sees that the session variable has been changed. If I manually refresh
the page, of course, it loads correctly that time. If I change the
items select, I submit the query, wait for it, go back to the
definition page and once again, it doesn't remember the new values. I
assume this has to do with IE loading that page completely from cache
no matter what I ask it to do. Actually, Firefox did this at first.
Then I had the code that the AJAX calls get the session variable and
pass it back in the XML. That fixed it in Firefox but IE doesn't even
seem to request that code.
I'm not sure if I've explained the problem very well so please ask
questions. I wish I could give you a link to the site but I can't (as
the client would have a cow). If necessary, I could probably produce a
much abbreviated version that just has enough to demonstrate the
problem but it would take a good bit of time so would rather not if I
don't have to.
I'm open to any suggestions. Actually, I'm considering going back to
the drawing board and eliminating the AJAX portion of the code and
rebuild the entire page each time the user changes the list because of
this. I'd rather not, but then, I need it to work. Not that I'm even
sure it would work then. Thanks for any help you can provide.