M
MattC
I have created a container class and instantiated it in one of my pages. I
fill the object on page load when not on a postback. On a button click i
want to do somethign with the values in that object, but on my button event
being reached the object is now empty.
private Visitor VisitorObj = new Visitor();
protected Label label1;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
VisitorObj.GetVisitorDetails(); //loads object here
}
}
private void UpdateButton_Click(object sender, System.EventArgs e)
{
label1.Text = VisitorObj.VisitorID; //object is now empty though!!!
}
Any idea why the values in this object aren't being maintained across
postback but contents of the form on the page is.
MattC
fill the object on page load when not on a postback. On a button click i
want to do somethign with the values in that object, but on my button event
being reached the object is now empty.
private Visitor VisitorObj = new Visitor();
protected Label label1;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
VisitorObj.GetVisitorDetails(); //loads object here
}
}
private void UpdateButton_Click(object sender, System.EventArgs e)
{
label1.Text = VisitorObj.VisitorID; //object is now empty though!!!
}
Any idea why the values in this object aren't being maintained across
postback but contents of the form on the page is.
MattC