How can keep class member properties value?

  • Thread starter Thread starter df
  • Start date Start date
D

df

We all know we can keep value of server control between post-back,but
how can do this with web form class member properties?For example,I
want to decare a class member property as array,to store some info very
posting,continuely,how to do this?

Thanks for any infomation and Happy New Year!
 
df said:
We all know we can keep value of server control between post-back,but
how can do this with web form class member properties?For example,I
want to decare a class member property as array,to store some info very
posting,continuely,how to do this?

Thanks for any infomation and Happy New Year!

Can you give more info on what your trying to store? Regardless as
always, you can throw all your stuff in the viewstate. The tradeoff is
performance.
 
Well,for example,I declare a Queue<string> RecentUploadFiles as the
class member field in .aspx.cs file,want it store recent uploaded file
infomation,one by one.

But now,every time I upload one file,this Queue has only one string,the
newest one.So,it must be re-created at every post-back,all other old
values are missed. We can see this is not what I want.Any idea?

Thank you very much,dear Joe.
 
hmmm. If I understand you correctly you probably dont want this info to
be lost when they click their back button. So, mabey this list should be
stored in a session variable?

Session["recentuploadFiles"] = x;

Joe MCAD
 
No,I just want the value keeping btween post back at the same aspx
page,instead of cross-aspx page.

hmmm. If I understand you correctly you probably dont want this info to
be lost when they click their back button. So, mabey this list should be
stored in a session variable?

Session["recentuploadFiles"] = x;

Joe MCAD


Well,for example,I declare a Queue<string> RecentUploadFiles as the
class member field in .aspx.cs file,want it store recent uploaded file
infomation,one by one.
But now,every time I upload one file,this Queue has only one string,the
newest one.So,it must be re-created at every post-back,all other old
values are missed. We can see this is not what I want.Any idea?
Thank you very much,dear Joe.
 
Back
Top