R
Ralph Krausse
My source to my test is below. I am trying to figure out state. I
create a int and a Test object and set them to some value on
Page_Load. When I click my button on my web page, Button1_Click gets
called but a = 0 and objTest.Name is null. Now it does make sense than
when the button is clicked, that a should be 0 and objTest should be
null but I thought that ASP.NET took care of this. Do I have to go
back to old ASP days and set this stuff to Application("objTest") =
objTest???? There must be a better way. Please enlighten me....
____________________________________________________________________________
My Test Class...
public class Test
{
public Test()
{
//
// TODO: Add constructor logic here
//
}
private string strName;
public string Name
{
get { return strName; }
set { strName = value; }
}
My ASP.NET PAGE
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
public Test objTest;
public int a;
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
objTest = new Test();
objTest.Name = "test";
a = 10;
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
a = 199;
objTest.Name = "a";
}
}
Thanks
Ralph Krausse
www.consiliumsoft.com
Use the START button? Then you need CSFastRunII...
A new kind of application launcher integrated in the taskbar!
ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg
create a int and a Test object and set them to some value on
Page_Load. When I click my button on my web page, Button1_Click gets
called but a = 0 and objTest.Name is null. Now it does make sense than
when the button is clicked, that a should be 0 and objTest should be
null but I thought that ASP.NET took care of this. Do I have to go
back to old ASP days and set this stuff to Application("objTest") =
objTest???? There must be a better way. Please enlighten me....
____________________________________________________________________________
My Test Class...
public class Test
{
public Test()
{
//
// TODO: Add constructor logic here
//
}
private string strName;
public string Name
{
get { return strName; }
set { strName = value; }
}
My ASP.NET PAGE
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
public Test objTest;
public int a;
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
objTest = new Test();
objTest.Name = "test";
a = 10;
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
a = 199;
objTest.Name = "a";
}
}
Thanks
Ralph Krausse
www.consiliumsoft.com
Use the START button? Then you need CSFastRunII...
A new kind of application launcher integrated in the taskbar!
ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg