WebGrid: How to access Session object in InitializeRow event handler?

5 replies. Last post: August 30, 2012 12:15 AM by Bernard Xiang
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Eric Member

I'm having a problem that for some reason our code is no longer working. I don't know since when exactly. The problem is this: Simple WebGrid. Tree-like structure. Option AllowAutoDataCaching intentionally turned off. Now when the user opens a node and does a resorting in the grid, the tree structure collapses, although there's code to preserve the opened nodes.

Debugging this, I saw that in the InitializeRow event handler I have no access to the Session object.

Please find attached a demo project which shows this behavior.

I know that the used version of WebGrid is outdated, but I assume with newer versions nothing changes in this behaviour.

I cannot switch on AllowAutoDataCaching or change other design decisions. As a solution or workaround maybe I have to switch on something so that the Session is active? I already tried to switch on the four FlyPostBackSettings attributes (see code), although this didn't help. And the data must be stored in the Session object, because this should be preserved even when the user comes back to this page after visiting other pages. Maybe the Session object can be passed in a different way?

 

1 attachment
All times are GMT -5. The time now is 10:28 AM.
Previous Next