Let's see if I undestood it right, first you want to have a label that changes depending on someone clicking a button, and second you want to refresh the page if at three hours(06:00, 14:00, 22:00).
There's a problem at least for me, you need to save the current label value somewhere between all the people that is working with the label system.
In my solution, you need a database to save it.
At the Page_Load
of the aspx file, I would call a function that returns the current label value, something like this:
public static string label = 0;
protected void Page_Load(object sender, EventArgs e)
{
label = getValueLabel();
}
The function getValueLabel
should go to the database and return the current label.
Now for the label resetting at some hours, I would do something with the task manager, and then set it on the webserver where the project is hosted.
It could be a simple console application, that goes to the database and updates the current label value.
You set this application to run at 06:00, 14:00 and 22:00, and this will clean the label value.
And last part for the webpage to reset at certain hours, you can use Javascript to do it.
Here's the solution from @Nick in this question.
function refreshAt(hours, minutes, seconds) {
var now = new Date();
var then = new Date();
if(now.getHours() > hours ||
(now.getHours() == hours && now.getMinutes() > minutes) ||
now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) {
then.setDate(now.getDate() + 1);
}
then.setHours(hours);
then.setMinutes(minutes);
then.setSeconds(seconds);
var timeout = (then.getTime() - now.getTime());
setTimeout(function() { window.location.reload(true); }, timeout);
}
When loaded the page just call the function three times.
refreshAt(06,0,0);
refreshAt(14,0,0);
refreshAt(22,0,0);
Hopefully I gave you some ideas so you can do it, it's kinda difficult if I cant see code or your project tree.