Reputation:
Please check the image below.
Below I have a simple lottery system where I have these columns,
I am feeling lost. Please help me.
I have tried few links , but did'nt get any satisfactory result. Here are the links
Call js-function using JQuery timer
Javascript event triggers based on local clock
How to periodically update server-side value on webpage?
Requirements (Update):
Please I need purely ASP.Net and C# (if possible) code. Any reference or link will be higly appreciated. Thanks in Advance
Upvotes: 0
Views: 1451
Reputation: 50682
Do NOT poll the server every second, that will create too much unneeded trafic.
Put a timer in the page (javascript) and when the timer reaches 0 poll the server.
The server should keep track of the time by itself; not relying on the client to provide the (potentially spoofed) time and pass back the appropriate response either winning tickets or nothing if it's not time yet to draw.
If you really need/want to push information from a server to the clients I recommend having a look at the suggestions here: https://stackoverflow.com/questions/6883540/http-server-to-client-push-technologies-standards-libraries
For SignalR have a look at this sample it is very close to what you need.
Do NOT use server side code to update the time on webpage unless it is critical.
For the countdown script look at the answer to this question: Javascript Countdown
When the timer reaches zero, refresh the page or execute an Ajax call using jQuery. When the call returns update the page depending on the server's response.
If you need more explicit answers you need to show what you have tried and point out problems you are having.
Upvotes: 2