ASP.NET, ViewState, and Events

Posts   
 
    
Posts: 497
Joined: 08-Apr-2004
# Posted on: 21-Jan-2005 16:00:46   

Howdee.

OK, you may have gathered this is not a LLBLGen question, but hopefully one of you out there is an asp.net guru, and can help me wink Here goes:

I am saving the viewstate in session rather than the request.form object. The reason is that when a user goes away and comes back to the page, I can redisplay their viewstate as it was last time they were there. My problem is that the ASP.NET LoadViewState event only fires when you do a postback - quite sensibly! But I need it to fire when I first go into the page, so that immediatly LoadViewState can get the viewstate from the session, and "do its thing"!

Does anyone know how to make the LoadViewState fire? Or failing that, does anyone know how I can manually populate my controls using the viewstate infomation that is persisted in the session??!! confused

Can I fire the event myself maybe?

Posts: 497
Joined: 08-Apr-2004
# Posted on: 21-Jan-2005 18:06:39   

Where are all the asp.net pro's when you need them wink

Maybe I should have named this post something more interesting....or posted it in the "its friday" thread wink

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 21-Jan-2005 20:22:47   

Well, why do you need to use viewstate? Viewstate is base64 data thats put into the page.

If youre going to use the sesstion, why not put a normal object into the session, then pluck it out and set the values on the form, and let view state do what view state does naturally?

The only way that I know to play with view state is to override the load and save view state and at that point youre working with a control object, and most likely doing your own rendering, which makes composite controls a nightmare.

Posts: 497
Joined: 08-Apr-2004
# Posted on: 24-Jan-2005 21:39:17   

Its for an infragistics problem. It turns out that infragistics stores its viewstate in the session automatically (or at least thats what I am led to believe) - which we were trying to lever for our own gain... What I actually want to happen is that when the user clicks a record from the infragistics grid, a new page pops up where they can edit the details. When the user hits "save" then we want the parent page to refresh but to maintain its viewstate, so some javascript is called which basically refreshes the parent. Its this refresh which causes problems, because asp.net treats it as a new request for the page, hence no viewstate load events, and a lost viewstate rage

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 24-Jan-2005 22:35:38   

Ugh, I would be in way over my head to even try, sorry man.