ASP.NET multi-page reserved state

xiaoxiao2021-03-06  84

Foreword

Today is the next day, I finally returned to CSDN, and wrote the first article on my blog.

I don't remember that I have a few blogs. I started to decide today. I recorded it here, I will have a life in the future.

ASP.NET multi-page reserved state

Just remember the status in the ASP.NET page is saved by ViewState. I think the page is not the same as you can borrow ViewState.

Microsoft said that ViewState is just relative to the single page, and I have found that there are a lot of work to be edited.

ViewState in the page. Because it is encoded with Base64. Of course, it can also be encrypted. Since it doesn't meet multi-page

There is no need to reserve the status problem.

Is it able to solve with sessions:

I tried it simply, because the control is not too much, just 10, I am listed in their session value. In

Initialize its status in Page_Load. As follows: This is fine.

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 ["sessdate"]. TOSTRING ();

TXTedate.text = session ["seedate"]. TOSTRING ();

TXTDPTSDATE.TEXT = session ["SedPTS"]. TOSTRING ();

TXTDPTEDATE.TEXT = session ["sedpte"]. TOSTRING ();

}

Maybe there is a better way, but I have not thought so too. Let's use it first.

转载请注明原文地址:https://www.9cbs.com/read-106921.html

New Post(0)