Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

AJAX vs. ViewState?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arthur Dent - 19 May 2008 18:10 GMT
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.
Cowboy (Gregory A. Beamer) - 19 May 2008 19:36 GMT
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.

Signature

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!

*************************************************
> Hello all...
>
[quoted text clipped - 12 lines]
> Thanks in advance,
> - Arthur Dent.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.