asp.net进度加载

use*_*537 2 c# asp.net loading

由于显示了大量数据,我有一个页面加载需要几秒钟.

我怎样才能使它播放.gif动画,直到数据准备好显示在表格中而不显示任何内容?

如何设置表/内容仅在加载完成后显示?

Agh*_*oub 7

你可以使用asp.net ajax控件,例如ScriptManager + UpdateProgress + UpdatePanel.这是一个例子

<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:UpdateProgress runat="server" id="PageUpdateProgress">
            <ProgressTemplate>
                Loading...
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel runat="server" id="Panel">
            <ContentTemplate>
                <asp:Button runat="server" id="UpdateButton" onclick="UpdateButton_Click" text="Update" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>


protected void UpdateButton_Click(object sender, EventArgs e)
{
    System.Threading.Thread.Sleep(5000);
} 
Run Code Online (Sandbox Code Playgroud)