Asp.net UpdateProgressBar控件不动态显示数据

时间:2014-06-04 15:15:11

标签: asp.net

我有一个aspx如下所示

 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
         <asp:UpdatePanel runat="server" ID="panel">
            <ContentTemplate>
                <asp:Button runat="server" id="bt" text="partial postback" OnClick="E"  />
            </ContentTemplate>
         </asp:UpdatePanel>
         <asp:Button ID="Button1" runat="server" text="full postback" OnClick="J" />
         <asp:UpdateProgress runat="server" ID="progress"  DynamicLayout="true" AssociatedUpdatePanelID="panel">
            <ProgressTemplate>
                <div class="divWaiting">
                    <asp:Label ID="lbl" runat="server" Text="OK" />
                    <asp:Image ID="imgWait" runat="server" ImageAlign="Middle" ImageUrl="images/indicator.gif" />
                </div>
            </ProgressTemplate>
         </asp:UpdateProgress>

On Code Behind我有一个函数在线程休眠3秒后更新我的标签

public void E(Object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(3000);
        Label lbl = (Label)progress.FindControl("lbl");
      if (lbl.ToString()!= null)
      {
          lbl.Text = "SomeThing";
      }

      update = true;
    }

0 个答案:

没有答案