G
Guest
Hello!
I Have a problem. I try to use asp.net page-wide variable but it is not
working. I declare my boolean variable (eg. bool done=false) in the same
place where page's web controls are declared. However when I try to use it in
a function, like
if (this.done==false) {
Response.Write("writing file")
this.WriteFile();
this.done=true;
}
But everytime when i use this function again after postback variable "done"
is set to "false" and WriteFile function is called again althought I set it
to true.
Is this because asp.net is stateless? Can I get around this using ViewState
to store variable's value? If ViewState can be used, could someone write a
small example how should it be used? The help is very much appreciated.
Thanks in advance.
Peter
I Have a problem. I try to use asp.net page-wide variable but it is not
working. I declare my boolean variable (eg. bool done=false) in the same
place where page's web controls are declared. However when I try to use it in
a function, like
if (this.done==false) {
Response.Write("writing file")
this.WriteFile();
this.done=true;
}
But everytime when i use this function again after postback variable "done"
is set to "false" and WriteFile function is called again althought I set it
to true.
Is this because asp.net is stateless? Can I get around this using ViewState
to store variable's value? If ViewState can be used, could someone write a
small example how should it be used? The help is very much appreciated.
Thanks in advance.
Peter