On Apr 3, 12:03 pm, aamirghan...@gmail.com wrote:
Quote:
Hi, I need to know if anyone else came across this. The Session
variable value I set in a sortCommand event handler of a datagrid does
not hold on till the next sortcommand event handler and reverts back
to its original value, the one I had set it before in the previous
trip sortcommand event handler.
>
I am trying to implement bidirectional sorting on a datagrid by making
use of session variable Session("SDirection"). In the sortcommand
event handler I check for its value and change it to DESC if its ASC
and vice-versa as follows:
Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
"ASC")
For the sake of simplicity I am not checking for the column in the
above code ... just the direction.
It sorts the dgrid fine for that pass, but next time a column (or same
column) header is clicked then in the sortcommand handler I find the
value to be the same that it was before I had made the change.
>
In the web.config the session configuration looks like this:
<sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
>
This app was originally in .Net 1.1 and was working perfectly fine
(and is on the 1.1 framework), but after converting it to 2.0 it has
lost this functionality.
>
If any one has had the same issue then please share.
>
thanks.
A couple of things I would look at right off the bat:
1. Double-check the *case* of the characters in the keys you're using
to reference the items in the session. I'm not sure if the code sample
above was pasted in, or typed from memory; I know I've run into issues
due to case-sensitivity with session keys. That is, Session("a") !=
Session("A").
2. Are you checking for the key's existence prior to retrieval? Try
setting a breakpoint, drop out to the command window in Visual Studio
and iterate over the Session.KeyNames collection and see if it's
there. It would be interesting to see if the key got dropped or
possibly overwritten.
Just a few things I can think of right off the top of my head.
Mike