F
Fred Exley
The first time I enter a page, I want to set a variable once, and have that
variable retain its value from that point on. So on the first time in the
program, I set runLoc = "yes". When I then call routine validatex, the
variable retains it's value. But when I call routine validatex from the
button click event, variable runLoc is null. How can I retain the value of
runLoc permanently? thanks
Here's the complete program:
using System;
public partial class scopeTest : System.Web.UI.Page
{
public string runLoc;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) // first pass:
{
runLoc = "yes";
}
validatex();
}
protected void Button1_Click(object sender, EventArgs e)
{
validatex();
}
protected void validatex()
{
string b = runLoc;
}
}
variable retain its value from that point on. So on the first time in the
program, I set runLoc = "yes". When I then call routine validatex, the
variable retains it's value. But when I call routine validatex from the
button click event, variable runLoc is null. How can I retain the value of
runLoc permanently? thanks
Here's the complete program:
using System;
public partial class scopeTest : System.Web.UI.Page
{
public string runLoc;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) // first pass:
{
runLoc = "yes";
}
validatex();
}
protected void Button1_Click(object sender, EventArgs e)
{
validatex();
}
protected void validatex()
{
string b = runLoc;
}
}