AJAX UpdateProgress控件显示问题
<asp:UpdatePanel ID="c_UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="c_txtname" runat="server"></asp:TextBox>
<asp:Label ID="c_labname" runat="server"></asp:Label>
<asp:Button ID="c_btname" Text="name" runat="server" onclick="c_btname_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="c_btname" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="c_UpdatePanel1">
<ProgressTemplate>
sssss......
</ProgressTemplate>
</asp:UpdateProgress>
如果把<asp:Button ID="c_btname" Text="name" runat="server" onclick="c_btname_Click" />
放在<asp:UpdatePanel>控件里就可以正常显示
但放在外面,就不显示<asp:UpdateProgress>内容
------解决方案--------------------将Button放在UpdatePanel外面就不是异步刷新了UpdatePanel块,
而是整个页面刷新,当然UpdateProgress不显示了,
也就是说,这个Button和UpdatePanel无任何关系!
------解决方案--------------------button放在updatePanel外面,刷新updatePanel
ScriptManager1.RegisterPostBackControl
<div ID="UpdateProgress1" runat="server" style="display:none"> 数据加载中,请稍后。。。 </div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate> 等待加载的内容 </ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack){ this.UpdateProgress1.Style["display"] = "block"; }
}
protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
this.UpdateProgress1.Style["display"] = "block";
}
------解决方案-------------------- <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div id="divProcess1"
style="border: 1px solid #ccc; background-color: #FFFFFF; padding: 15px; margin: 15px">
<img align="absmiddle" border="0" src="images/progress.gif" />
数据处理中...
</div>
</ProgressTemplate>
</asp:UpdateProgress>