PublicShared VisitorApplicationOpenDate As DateTime = CDate(ConfigurationManager.AppSettings("VisitorApplicationOpenDate"))
PublicShared VisitorApplicationCloseDate As DateTime = CDate(ConfigurationManager.AppSettings("VisitorApplicationCloseDate"))
PublicShared VisitorApplicationsIsOpen AsBoolean = (Now >= VisitorApplicationOpenDate) And (Now <= VisitorApplicationCloseDate)
I uses the VisitorApplicationsIsOpen in the application form to check if the application is open.
But the problem is, it works but not always.
For example the application should of opened this morning but it dit not, when I opened the web.config and saved the file without doing any changes, the application was opened. And it is not the first time it has happened.
A shared/static field initializer will only run once, usually when the class is first accessed. If that happens when the current time is not within the range, then the field will be initialized to False.
Try changing the VisitorApplicationsIsOpen field to a property:
In my application which is developped in VS 2010 there is a search page where the user input the search parameter and do a search operation. And the grid is populated with the search results. When user moves to the previous page through the default back button and agin comes back by the forward button present in the browser I lose all the data which was fetched. Could you please suggest me how can I hold those datas both in the grid and in the search fields. Please explain me by giving a valid example.