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>
复制代码 代码如下:
<%@ 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>
上一篇: 详细介绍.NET中的动态编译技术
下一篇: Android手机信号强度检测详细介绍