We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Timers in asp.net using C#

Hi, I am Sabareswaren doing an In-House project, which we have to run a movie in one page say (video.aspx.cs). Each user has some seconds access to see the movie and after that the page should automatically close. i use timer here to do this. i retreive the Account (Seconds to see the movie)of each user from the DataBase (MySQL). i dont have any idea about timers in asp.net. if i finish this my project get over.so please help me to finish this!!!! Thanks in Advance!!!!! Yours Sabareeswaren

4 Replies

AD Administrator Syncfusion Team April 4, 2006 02:15 PM UTC

Hi Sabari, There is no Timers in Asp.net , instead you can use a javascript function and keep a settimeout function instead. so when setting this properly in proper place , i guess this can be done. I am roughly illutrating this for example when clicking on a play button will trigger the setTimeout(10000)(see some where the exact syntax) on doing this , and obviously you might have the user who logged in some where in the page. so with that , you can change the time accordingly and if the time is out of limit provided then do as needed like var btnStop=ocument.getelementbyid("StopButton").id; btnStop.click ( or what ever action you want it to be made to) Best wishes for your project. -Hari


SA Sabareeswaren April 5, 2006 05:55 AM UTC

Hi Hari, Thanks for your valuble reply. me too in the thought of doing in JavaScript. But i need to use one database value [Seconds] which i retreive from my database(MySQL). I dont have any idea for Connecting the database in JavaScript, also in MySQL. Could you please help me to finish the database part. its very urgent!!! Please do help me..... I need the connection coding........ Thanks in Advance!!!!!! Sabareeswaren.


AD Administrator Syncfusion Team April 5, 2006 11:56 AM UTC

Hi Sabari, I am not sure weather the following suggestion might help . 1) you cannot connect the client side javascript with the database. instead you can use some hidden field value to store the seconds for the paricular user when the page loads. and check for the timer using the time out as i suggested before Beast regards, A.Sivakumar


SA Sabareeswaren April 6, 2006 07:26 AM UTC

Hi hari, thanks for your reply. i will check and say. and can you check this is working or not [code] Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60) + 10) & "; URL=Login.aspx") [/code] Now i have a window say(viewonline.aspx.cs) running media player and i am also using Sessions for counter. if the user close that window, a POP-UP window should come having some message and 2 buttons ''YES'' and ''NO''. if i press ''YES'' the counter value should update in the Database, if ''NO'' no action, it should continue to display the movie. please help me..... how can i display a pop-up window while closing the window ''[X]''? Please do help me!!!!! Thanks in Advance!!!! Sabareeswaren.

Loader.
Live Chat Icon For mobile
Up arrow icon