473,498 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX vs. ViewState?

Hello all...

Quick Q... I have a page which on load, retrieves some data from the db, and
then stores it in the viewstate. It is a small snippet of XML.
I have some controls on the page which post back via AJAX; in their
handlers, the page attempts to refer to this XML from the viewstate (to
minimize roundtrips to the db server).
It seems though that when they post back, this information (the XML) is
gone.

Do AJAX postbacks not have access to what was stored in the viewstate?
Looking online, I see a lot of people questioning about this, but no
definitive answers.

Thanks in advance,
- Arthur Dent.

Jun 27 '08 #1
1 2027
ViewState is a hidden field in the page that is encoded. Unless you send
that information back to the server in your AJAX call, it will never be
available, as the server does not store ViewState. If, instead, you store
items in session, you can pull them, but I would not retool a site to stick
everything in session just so you can use it with AJAX.

As each field on the page is accessible, you can send as much info as you
like. This will generally be better than wiring the ViewState to AJAX.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"Arthur Dent" <hi*********************@yahoo.comwrote in message
news:58**********************************@microsof t.com...
Hello all...

Quick Q... I have a page which on load, retrieves some data from the db,
and then stores it in the viewstate. It is a small snippet of XML.
I have some controls on the page which post back via AJAX; in their
handlers, the page attempts to refer to this XML from the viewstate (to
minimize roundtrips to the db server).
It seems though that when they post back, this information (the XML) is
gone.

Do AJAX postbacks not have access to what was stored in the viewstate?
Looking online, I see a lot of people questioning about this, but no
definitive answers.

Thanks in advance,
- Arthur Dent.
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3001
by: GTi | last post by:
I have a ASP 2.0 page where I use some Ajax code. The Ajax code (JavaScript) is inserted from CodeBehind. In my page I have a submit button and some links for Ajax functions. When I load the page...
5
1253
by: aroraamit81 | last post by:
I am using AJAX, it works very fine.............. But the problem is my back end aspx page does not get refreshed rather it picks old values now when I execute the aspx page explictly then the...
5
1750
by: darrel | last post by:
I've been playing with prototype.js and scriptaculous to create some nice drag-and-drop interaction on my applications GUI. That's working well. Now I want to take the next step and start passing...
0
982
by: Darren.Ratcliffe | last post by:
Hi everyone I am getting the above problem when I am trying to use AJAX on my Visual Studio 2005 solution - I seem to keep getting it when I click the back button in my browser. (And, the...
4
2524
by: Rob Meade | last post by:
Hi all, I played with my first bit of AJAX the other week and was pleasantly surprised that I achieved my goal..now I'd like to try something else.. Question... If I have an updatePanel,...
2
2357
by: DanWeaver | last post by:
I have a page where layout of buttons and listboxes etc is important - I would like to make use of Ajax Update panel to asynchronously update various part of the page- in Vis studio whenever I use...
1
1009
by: bharathreddy | last post by:
Dear All, I want some information regarding Ajax, What i know about ajax is If we use ajax to call a function, it will execute the server side function directly without executing page_load...
2
2023
by: Jeremy | last post by:
I've got a very large listbox that gets populated using ajax. The listbox and a button are in a panel inside an update panel. The button click of the button sets the panel visible property to...
1
2703
by: wagswvu | last post by:
I am trying to enclose SPGridView inside an UpdatePanel control in a user control page (.ascx), however whenever I click on the paging links for the grid, it still postbacks instead of partial page...
0
6998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.