简体   繁体   English

如何在Visual Studio 2010中向C#Web应用程序添加计时器

[英]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.

相关问题 身份验证如何应用于在Visual Studio 2010中使用C#的Web应用程序的所有aspx页面? - How does the authentication apply to all aspx pages for a Web Application using C# in Visual Studio 2010? 如何在Visual Studio 2010表单应用程序中启动计时器 - How to start timer in Visual Studio 2010 Form Application 在visual studio professional 2010上使用试用版部署Web应用程序c# - Deploying a web application using the trial version on visual studio professional 2010 c# 如何在Visual Studio中开发的C#应用​​程序中添加空白行? - How to add a blank lines in C# application developed in Visual Studio? 尚未解决Visual Studio 2010“ System.Web”参考[C#] - Visual Studio 2010 “System.Web” reference unresolved [C#] 客户端和C#的Expression Web 4与Visual Studio 2010 - expression web 4 vs visual studio 2010 for client side and c# 在Visual Studio 2010 C#应用程序中添加脚本文件 - Adding a script file in a Visual Studio 2010 C# application 断言在C#WPF应用程序的Visual Studio 2010中不起作用 - Asserts not working in Visual Studio 2010 in a C# WPF application C#Visual Studio 2010表单应用程序错误消息 - C# Visual Studio 2010 form application error message 如何在C#中制作可视的可重用类?(Visual Studio 2010) - How to make a visual reuasable class in C#?(Visual Studio 2010)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM