static or else?# DotNet - 窗口里的风景
c*o
1 楼
Once a button is clicked on a web form, a Post message will send to the
server, where the code Page_Load () will be executed. However, I don't want to
initialize the Profile p again, so I put it is !IsPostBack(). But in this
case, the p will be null in the button's click event handling function
lkbtEmail_Click(). If I put initProfile() out of !IsPostBack(). It works. But
the initProfile() is a procedure which get a lot of information from the
database. I just want to do it once. How can I do it?
server, where the code Page_Load () will be executed. However, I don't want to
initialize the Profile p again, so I put it is !IsPostBack(). But in this
case, the p will be null in the button's click event handling function
lkbtEmail_Click(). If I put initProfile() out of !IsPostBack(). It works. But
the initProfile() is a procedure which get a lot of information from the
database. I just want to do it once. How can I do it?