正文

利用ASP.NET AJAX实现无刷新的分页等待功能2007-03-01 02:41:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/goalbell/23569.html

分享到:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
    protected void GridView1_PageIndexChanged(object sender, EventArgs e)
    {
        //延迟3秒显示
        System.Threading.Thread.Sleep(3000);
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>My First AJAX Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
               <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    DataKeyNames="username" DataSourceID="SqlDataSource1"  OnPageIndexChanged="GridView1_PageIndexChanged" AllowSorting="True" ForeColor="#333333" GridLines="None" >
                   <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField DataField="username" HeaderText="username" ReadOnly="True" SortExpression="username" />
                        <asp:BoundField DataField="Subcompany" HeaderText="Subcompany" SortExpression="Subcompany" />
                    </Columns>
                   <PagerStyle BorderColor="#FFC080" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EHRConnectionString %>"
                    SelectCommand="SELECT [username], [Subcompany] FROM [STAFF] ORDER BY [id]">
                </asp:SqlDataSource>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
            <ProgressTemplate>
               <img src="images/loading.gif" /><div style="background-color:Red;color:#fff;width:64px">Loading...</div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </form>
</body>
</html>

阅读(5829) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册