随笔-68  评论-89  文章-0 

asp.net ajax 分页等待效果

<%@ 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>

 

posted on 2007-06-01 17:20 噢耶游戏 阅读(...) 评论(...) 编辑 收藏