Asp.net| page Preface
today is my new job the next day, finally returned to CSDN, on their blog to write the first article.
do not remember how many blogs they have, today began to decide, in this record, I later days and life bar.
asp.net retention status between multiple pages
only remember that the status in the ASP.net page is saved by viewstate. I think the page can also borrow viewstate.
Microsoft said, ViewState is only relative to the single page, and, I also found that there are a lot of work can be reversed edit
the ViewState within the page. Because it's encoded in Base64. Of course, you can also encrypt it. Since, it does not meet the multiple page
Keep the state problem between
, then don't use it.
with the session is not able to solve it:
I have a simple try, because the page control is not too much, just 10, I listed their session value. And then in
Initializes its state in the
Page_Load. As follows: This will do.
private void Page_Load (object sender, System.EventArgs e)
{
if (! IsPostBack)
{
//
if (session["Deal_page"]!=null)
{//This is
from other pages.
if (session["Deal_page"). Equals ("Deal_page"))
{
Init_form ();
}
}
Bind_draggrid ();
}
}
private void Init_form ()
{
Txtcompanyname.text = session["Secomp"]. ToString ();
Txtrsrvman.text = session["Sersrv"]. ToString ();
Txtphone.text = session["Sephon"]. ToString ();
Txtsalemanger.text = session["Sesale"]. ToString ();
Txtcronum.text = session["Secron"]. ToString ();
Txtgrpgstname.text = session["SEGRPG"]. ToString ();
Txtsdate.text = session["Sesdate"]. ToString ();
Txtedate.text = session["Seedate"]. ToString ();
Txtdptsdate.text = session["Sedpts"]. ToString ();
Txtdptedate.text = session["Sedpte"]. ToString ();
}
may have a better way, but I haven't thought too well. Let's use this for a while.