0

I have defined an <asp:UpdatePanel> with an <asp:UpdateProgress> as

  <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="update1" runat="server">
        <ContentTemplate>
            <asp:Label id="lblresult" runat="server"></asp:Label><br /><br />
            <asp:Button ID="btn1" runat="server" Text="Refresh" OnClick="btn1_Click" />    <br />

      </ContentTemplate>
    </asp:UpdatePanel>
     <asp:UpdateProgress ID="up1" runat="server" AssociatedUpdatePanelID="update1">
                <ProgressTemplate>
                        <span style="color:green; font-style:italic;">Loading, please wait...</span>    
                </ProgressTemplate>
    </asp:UpdateProgress>    

The button event is defined as

protected void btn1_Click(object sender, EventArgs e)
{
    lblresult.Text = "<span style='color:red;'>"+ DateTime.Now.ToString() +"</span>";
}

However, I do not get the Loading, please wait...

4

2 回答 2

1
<script type="text/javascript">
    var updateProgress = null;

    function postbackButtonClick() {
        updateProgress = $find("<%= uprMaster.ClientID %>");
        window.setTimeout("updateProgress.set_visible(true)", updateProgress.get_displayAfter());
        return true;
    }
</script>

<asp:Button runat="server" Text="Search" ID="btnSearch" OnClick="btnSearch_Click" ClientIDMode="Static" OnClientClick="return postbackButtonClick();"   />
于 2014-02-25T17:29:38.140 回答
0

像这样把更新进度放在里面

<asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="update1" runat="server">
        <ContentTemplate>

          <asp:UpdateProgress ID="up1" runat="server" AssociatedUpdatePanelID="update1">
            <ProgressTemplate>
                    <span style="color:green; font-style:italic;">Loading, please wait...</span>    
            </ProgressTemplate>

        <asp:Label id="lblresult" runat="server"></asp:Label><br /><br />
        <asp:Button ID="btn1" runat="server" Text="Refresh" OnClick="btn1_Click" />    <br />

  </ContentTemplate>
</asp:UpdatePanel>

</asp:UpdateProgress>   
于 2013-01-29T04:59:48.713 回答