欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Asp.net ajax实现任务提示页面的简单代码

程序员文章站 2024-02-29 12:48:22
复制代码 代码如下:<%@ page language="c#" %>
复制代码 代码如下:

<%@ page language="c#" %>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en"
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<script runat="server">
    void waitfiveseconds(object o, eventargs e)
    {
        system.threading.thread.sleep(5000);
        label1.text = datetime.now.tolongtimestring( );
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head1" runat="server">
<title>asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
    <asp:scriptmanager id="scriptmanager1" runat="server" />
    <asp:updatepanel id="updatepanel1" runat="server">
        <contenttemplate>
            <asp:button id="button1" runat="server" text="do something" onclick="waitfiveseconds" /><br />
            <asp:label id="label1" runat="server" />
        </contenttemplate>
    </asp:updatepanel>
    <asp:updateprogress id="updateprogress1" runat="server" associatedupdatepanelid="updatepanel1">
        <progresstemplate>
        <div style="position: absolute; left: 200px; top: 150px; border: solid 1px black; padding:4px;">
            loading, please stand by ...
        </div>
        </progresstemplate>
    </asp:updateprogress>
</form>
</body>
</html>