# 后台 protected void D(object sender, EventArgs e) { Label1.Text = DateTime.Now.ToString(); <span style="color:#ff9966;">ScriptManager1.RegisterAsyncPostBackControl(this.Button1); UpdatePanel1.Update();</span> //var j = 50; //Page.ClientScript.RegisterStartupScript(GetType(), "key" + j, "<script>D(" + j + ");</script>", false); for (int j = 3; j < 10; j++) { SetProgress(j); // Thread.Sleep(1000); } //var k = 93; //////for (int j = 0; j < 100; j++) //////{ ////// Thread.Sleep(10000); //// // ScriptManager.RegisterStartupScript(this, Page.GetType(), "", "D("+j+");", true); //// // this.Page.ClientScript.RegisterStartupScript(csType, "", "<script>Go("+j+");</script>", false); ////for (k=90; k > 0; k--) ////{ //this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>D(" + k + ");</script>", false); } 前端 <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="True" UpdateMode="Conditional"> <span style="color:#ff9966;"> <ContentTemplate></span> <asp:Label runat="server" Text="Label" ID="Label1"></asp:Label> </ContentTemplate> <%--<div id="p"></div>--%> </asp:UpdatePanel> <div id="p"></div> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="D" /> </div>