首页 > 开发 > AJAX > 正文

AJAX应用带标题更新

2024-07-21 02:26:10
字体:
来源:转载
供稿:网友
中国最大的web开发资源网站及技术社区,

这里的一个应用是updateprogress的应用完善。为了给用户显示的效果更好而设计。你可以参看效果:

http://szhxy.gliet.edu.cn/qxgl/登录显示的更新过程。

代码如下:


<%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="_default" %>

<!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style type="text/css">
#updatepanel1 ...{
  width: 300px;
  height: 100px;
  border:solid 1px gray;
}   
</style>
    <title>更新测试</title>
</head>
<body>

    <form id="form1" runat="server">
        <asp:scriptmanager id="scriptmanager1" runat="server" enablepagemethods="true" enablescriptglobalization="true" >

        </asp:scriptmanager>
        <div visible="false">
            <asp:updateprogress id="updateprogress1" runat="server" associatedupdatepanelid="updatepanel1" displayafter="0">
                <progresstemplate>
                                   
                <div id="progress" >
                   
            <table cellpadding="4" cellspacing="0" >
            <tr>
                <td >
                <span >&nbsp;<strong>系统提示</strong></span></td>
            </tr>
            <tr>
                <td  valign="middle" >
                <br />
                <br />
                <img alt="waiting..." src="http://www.pushad.com/info/indicator_mozilla_blu.gif" />
                <span >正在处理,请稍后……</span></td>
            </tr>
    </table>
                </div>
                </progresstemplate>
            </asp:updateprogress>
        </div>

        &nbsp; &nbsp;&nbsp; &nbsp;
        <asp:updatepanel id="updatepanel1" runat="server">
            <contenttemplate>
                &nbsp; 密码:<asp:textbox id="textbox2" runat="server"></asp:textbox>
                <br />
                密码确认:<asp:textbox id="textbox1" runat="server"></asp:textbox>
        <asp:button id="button1" runat="server" onclick="button1_click" text="button" />
            </contenttemplate>

        </asp:updatepanel>
        &nbsp;
    </form>   
</body>
</html>

cs代码:
using system;
using system.data;
using system.configuration;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;

public partial class _default : system.web.ui.page
...{
    protected void page_load(object sender, eventargs e)
    ...{

    }
    protected void button1_click(object sender, eventargs e)
    ...{
        //system.threading.thread.sleep(3000);
        int j = 0;
        for (int i = 0; i < 100000000; i++)
        ...{
            j = i+j;
       
        }
            if (textbox1.text.equals(textbox2.text))
            ...{
                response.redirect("/login.aspx");
            }
            else
            ...{
                response.redirect("/error.aspx");
            }
      
    }

}

不过根据研究,http://szhxy.gliet.edu.cn/qxgl/login.aspx?returnurl=%2fqxgl%2fdefault.aspx使用的方法如下:
他是通过调用htm文件实现图像显示的。

将表单代码去掉替换如下:
<iframe scrolling="no" frameborder="0" marginwidth="0" marginheight="0" src="bar.htm" /></iframe>

可见还需要一个bar.htm。这样我们就建个:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>系统提示</title>
</head>

<body >
    <table cellpadding="4" cellspacing="0" >
            <tr>
            <td >
                <span >&nbsp;<strong>系统提示</strong></span></td>

        </tr>
        <tr>
            <td  valign="middle" >
                <br />
                <br />
                <img alt="waiting..." src="http://www.pushad.com/info/indicator_mozilla_blu.gif" />
                <span >正在处理,请稍后……</span></td>
        </tr>

    </table>

</body>
</html>

测试通过

 

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表