How can keep class member properties value?

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!
 
J

Joe (MCAD)

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.
 
D

df

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.
 
J

Joe (MCAD)

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
 
D

df

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top