如何在asp.net中添加检查计时器? [英] how to add a exam timer in asp.net?

查看:99
本文介绍了如何在asp.net中添加检查计时器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,每一个人我都需要一个代码,通过它我可以添加用于检查的计时器...
我的项目处于在线考试中,因此用户可以指定考试时间,并且随着计时器的结束,用户考试窗口将关闭.

help plz

hey every1 i need a code by which i can add a timer for an examination ...
my project in an online exam so the user wil specify time for exam and as the timer ends user exam window will get closed.

help plz

推荐答案

ajax计时器控件与您所需的完全相同

代码
ajax timer control do the exactly same as you required

Code
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown" />
        <asp:timer runat="server" id="UpdateTimer" interval="5000" ontick="UpdateTimer_Tick" xmlns:asp="#unknown" />
        <asp:updatepanel runat="server" id="TimedPanel" updatemode="Conditional" xmlns:asp="#unknown">
            <triggers>
                <asp:asyncpostbacktrigger controlid="UpdateTimer" eventname="Tick" />
            </triggers>
            <contenttemplate>
                <asp:label runat="server" id="DateStampLabel" />
            </contenttemplate>
        </asp:updatepanel>





protected void UpdateTimer_Tick(object sender, EventArgs e)
{
    Response.Write("<script>alert('Time Over')</script>");
    Response.Redirect("result.aspx");
}





interval="5000" mean 5sec, you just need to modify this value 30min.
30min= 60000*30


这篇关于如何在asp.net中添加检查计时器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆