My web page has a timeout of 5 minutes. I want to show the users the count down in minutes and seconds so I want to show something like :
4 minutes and 10 seconds left
I tried to implement below code in order to achieve this:
<asp:Timer ID="Timer1" runat="server" Interval="5000" ontick="Timer1_Tick">
</asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<span style="border:2px; color:tomato">Time Remaining:<asp:Label ID="Label1" runat="server"></asp:Label></span>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick">
</asp:AsyncPostBackTrigger>
</Triggers>
</asp:UpdatePanel>
This is showing the timer, but the time is showing like so:
I want to show the timer as minutes and seconds. How can I achieve that. Below is my .cs page code:
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.Second.ToString();
}