Page level variables reset during Ajax post back

R

radix

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
 
G

gerry

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 /
.... )
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

radix said:
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.

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.
 
R

radix

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top