Click here to Skip to main content
15,905,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi developers,

In my ASP.NET application, based on RETAIL MANAGEMENT i have used GRID VIEW with editable controls(textbox, dropdown) for Billing purpose.


The Problem is, if my webpage remains ideal for half-an-hour it cause my STATIC variables to loose data's. Because i maintain a DATATABLE as STATIC Variable and update user entered gridview data's in my Static datatable. After half-an-hour or more it throws error as "Cannot find Column name 'xxx'". Hence i finalize that my STATIC variable loose its contents.

And, I am sure its not SESSION problem, because my code is very clear in using Sessions(have set valid timeout)(Verified Successfully).


Now how can i extend these STATIC variable's lifetime ? (or) Is there any other ways to handle this situation ?
Please help me out.
Posted

1 solution

Statics are "live" for the duration of the application - which isn't as long as you might think. In fact, technically, it is when the web page has been completely loaded to the browser that the application can die. A new copy of the application is loaded when the web page refreshes, or reloads, or another client requests the page. Static variables are not maintained across this.

Put information you want to preserve either in the Session or in Cookies - that way you can read it back when you need it.
 
Share this answer
 
Comments
J.Karthick 7-Dec-11 1:07am    
Yes....Thanks for your Solution.
Here i'm using GRID, hence i can read it directly from the GRID itself.

Thanks again for your reply

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900