指定何时显示UpdateProgress控件

时间:2011-09-15 16:36:22

标签: asp.net updateprogress

当单击某个按钮时不显示UpdatePrgress控件时,是否有人拥有资源或提供代码示例。

1 个答案:

答案 0 :(得分:0)

标记中的

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <fieldset>
        <legend>UpdatePanel</legend>
        <asp:Label ID="Label1" runat="server" Text="Initial page rendered."></asp:Label><br />
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
        </fieldset>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
    <ProgressTemplate>
        Processing...
    </ProgressTemplate>
</asp:UpdateProgress>

在您的代码中:

protected void Button1_Click(object sender, EventArgs e)
{
    // Introducing delay for demonstration.
    System.Threading.Thread.Sleep(3000);
    Label1.Text = "Page refreshed at " +
        DateTime.Now.ToString();       
}

这应该有效,试试吧......

来源:Introduction to the UpdateProgress Control