我的 aspx.cs 的页面加载方法是这样的
namespace BHELDISP
{
public partial class welcomeuser : System.Web.UI.Page
{
DataClass obj = DataClass.getObj();
protected void Page_Load(object sender, EventArgs e)
{
if (obj.getdate1() != null&&obj.getdate2() != null)//here is my problem where if load in other browser also this if getting executed
{ //instead of else, i think its because of static object..but how can resolve this one
//doing some calculation..
}
else
{
obj.setdate(txtdate1.Text);//first text box
}
}
}
}
在这里我有一个业务层,我将数据存储在静态对象中
namespace bal
{
public class DataClass
{
public string date1;
public string date2;
static public DataClass dcobj;
static public DataClass getObj()
{
if (dcobj == null)
{
dcobj = new DataClass();
return dcobj;
}
return dcobj;
}
public string getdate1()
{
return date1;
}
public void setdate1(string date1)//store date1
{
this.date1 = date1;
}
}
}
我有这个静态对象的问题,如果我在另一个浏览器中加载页面,它会得到相同的值
请任何人都可以帮助我
提前谢谢你..