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 / July 2007

Tip: Looking for answers? Try searching our database.

Page level variables reset during Ajax post back

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
radix - 23 Jul 2007 20:56 GMT
Hello,

I have a aspx page with ajax scriptmanger update panel etc. I also
have public string variables on the aspx page.

Whenever postback happens from Ajax update panel, at server side all
the public string variables are reset to empty string. As if fresh
page is loaded. How to preserve the page level variables during Ajax
postback?

thanks!
Radix
gerry - 23 Jul 2007 21:09 GMT
a 'fresh page' is being loaded - updatepanel postback is still a postback.
any data you wish to preserve between postbacks should be saved either in
the form ( hidden fields / view state  ) or saved on the server ( session /
... )

> Hello,
>
[quoted text clipped - 8 lines]
> thanks!
> Radix
Göran Andersson - 23 Jul 2007 21:24 GMT
> Hello,
>
[quoted text clipped - 3 lines]
> Whenever postback happens from Ajax update panel, at server side all
> the public string variables are reset to empty string.

They are set to null, unless you actually assign them empty strings.

> As if fresh page is loaded.

That's because a fresh page _is_ loaded.

An ajax call makes a regular postback, it just doesn't make a regular
response.

> How to preserve the page level variables during Ajax
> postback?

You can't. You persist data between postbacks just as you do between any
other postback.

Signature

Göran Andersson
_____
http://www.guffa.com

radix - 23 Jul 2007 21:35 GMT
Yeah, I used sessions and saved my variables.

Strings were intialized to so they were not null... but they are nulls
if not initialzed. Thanks!

On Jul 23, 4:24 pm, G?ran Andersson <gu...@guffa.com> wrote:
> > Hello,
>
[quoted text clipped - 22 lines]
> G?ran Andersson
> _____http://www.guffa.com

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.