Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 690
  • Last Modified:

ViewState with AJAX in ASP.NET

Hi,

I have a page with AJAX enabled. I want to store some information on server side in the ViewState object as

ViewState("Key") = Value

Does this persists between the postbacks - because page is a partial rendering ? If it is not going to be persisted between the postbacks then what i need to do to get the value from ViewState ?

Thanks
0
milani_lucie
Asked:
milani_lucie
  • 3
  • 2
2 Solutions
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Does it need to be in the viewstate or can you store it in the session?

Session("key") = value
0
 
milani_lucieAuthor Commented:
ged325:

Needs to be in ViewState. I do not want the Session overhead on the server. BTW: Is Session is going to be persisted between the postbacks ?

Thanks
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Session is persisted.

http://helpcentral.componentone.com/CS/forums/t/74987.aspx

Looks like the viewstate is not persisted.  How bout a cookie instead?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Kyle AbrahamsSenior .Net DeveloperCommented:
http://blog.js-development.com/2009/02/howto-persist-viewstate-on-server-side.html

A temporary solution to persist the viewstate, but still you're going to have the server doing the work.
0
 
NazoUKCommented:
If you're using updatepanels then the ViewState is persisted. The ViewState is passed back to the server when an ajax call is made and then passed back to the page.
In other words you can use ViewState as normal on a page with updatepanels but you should do so with caution: a large ViewState can slow the updatepanels to a crawl and make for a very frustrating user experience.
0
 
NazoUKCommented:
As an aside, the page ged325 linked to is talking about Client Callbacks which is not the same as the partial rendering achieved through ASP.NET AJAX and UpdatePanels.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now