Click here to Skip to main content
15,897,334 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a website for reserving hotel rooms. I want to put a 30 mins timer for this process . I mean while the customer is filling the information of reserve in MULTIPLE PAGES , I have a timer to show how much time is remained that he allowed to finish the reservation. I want to know if its possible and how ?
thanks in advance
Posted
Updated 18-May-15 0:25am
v2

1 solution

When the process starts, store the expiry time in the session

C#
protected void Page_Load(object sender, EventArgs e)
{
    if (Session["Expiry"] == null)
    {
        Session["Expiry"] = DateTime.Now.AddMinutes(30);
    }
}


The use some javascript to show a countdown on each page

Countdown timer in asp.net[^]

Rather than hard-coding the interval you get the minutes left from the date stored in the session

var min = <%=(((DateTime)Session["Expiry"])  - DateTime.Now).Minutes %>;
 
Share this answer
 

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