[英]How to add a timer to c# Web Application in Visual studio 2010
I have a very basic web page built intro page, press start button opens main page, press finish button openings thank you page 我有一个非常基本的网页内置介绍页面,按开始按钮打开主页,按完成按钮打开谢谢页面
I need to insert a timer so that it starts when the user presses the start button on the intro page and stops when they press the finish button on the main page. 我需要插入一个计时器,以便它在用户按下简介页面上的“开始”按钮时启动,并在用户按下主页上的“完成”按钮时停止。
You can always use a session variable to store the DateTime.Now value in the intro page and then check the time difference at a later time. 您始终可以使用会话变量将“ DateTime.Now”值存储在简介页面中,然后在以后检查时差。 That is the most easy thing I think of. 那是我想到的最简单的事情。 Not the most good looking, but the easiest. 不是最漂亮的外观,而是最简单的外观。
Easiest way is to use DateTime.Now.ToString()
, more information MDSN: DateTime.Now Property . 最简单的方法是使用DateTime.Now.ToString()
,更多信息MDSN:DateTime.Now Property 。 So eventually you always can find difference between current and launched time. 因此,最终您总是可以发现当前时间与启动时间之间的差异。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.