Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ViewState with AJAX in ASP.NET

Posted on 2009-06-30
6
Medium Priority
?
683 Views
Last Modified: 2012-05-07
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
Comment
Question by:milani_lucie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 40

Assisted Solution

by:Kyle Abrahams
Kyle Abrahams earned 720 total points
ID: 24749601
Does it need to be in the viewstate or can you store it in the session?

Session("key") = value
0
 

Author Comment

by:milani_lucie
ID: 24749641
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
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 24749660
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 24749683
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
 
LVL 15

Expert Comment

by:NazoUK
ID: 24752389
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
 
LVL 15

Accepted Solution

by:
NazoUK earned 780 total points
ID: 24752458
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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question