更新进度GIF图像不能显示当我点击模态弹出扩展按钮 [英] Update Progress GIF Image Can't be displayed when i click on a button in Modal pop Extender
问题描述
我有,我不能显示我的更新进度GIF图像的问题,当我在模式弹出扩展点击按钮
在ASPX code是:
< ASP:的ScriptManager ID =ScriptManager1=服务器>
< / ASP:ScriptManager的>
< ASP:的UpdateProgress ID =UpdateProgress1=服务器AssociatedUpdatePanelID =UpdatePanel1>
< ProgressTemplate>
< IMG SRC =AJAX-loader.gif/>
< / ProgressTemplate>
< / ASP:&的UpdateProgress GT;
< ASP:的UpdatePanel ID =UpdatePanel1=服务器>
<&的ContentTemplate GT;
< ASP:按钮的ID =Button2的=服务器文本=按钮/>
< ASP:面板ID =Panel1的=服务器>
< ASP:按钮的ID =Button1的=服务器文本=按钮的OnClick =的button1_Click/>
< / ASP:面板>
< ASP:ModalPopupExtender PopupControlID =面板1的TargetControlID =Button2的ID =mpeConfirm
=服务器>
< / ASP:ModalPopupExtender>
< /&的ContentTemplate GT;
< / ASP:的UpdatePanel>
和在code后面我写了简单的code要能显示进度:(:
保护无效的button1_Click(对象发件人,EventArgs的发送)
{
Thread.sleep代码(2000);
}
1天之后谷歌搜索。我做了吧:) .The解决方案很容易,真正了不起的。
首先,我做了一个设计简单的修改。我刚搬到像下面Modalpop扩展面板控件内更新面板:
< ASP:的ScriptManager ID =ScriptManager1=服务器>
< / ASP:ScriptManager的>
< ASP:的UpdateProgress ID =UpdateProgress1=服务器>
< ProgressTemplate>
< IMG SRC =AJAX-loader.gif/>
< / ProgressTemplate>
< / ASP:&的UpdateProgress GT;
< ASP:按钮的ID =Button2的=服务器文本=按钮/>
< ASP:面板ID =Panel1的=服务器>
< ASP:的UpdatePanel ID =UpdatePanel1=服务器>
<&的ContentTemplate GT;
< ASP:按钮的ID =Button1的=服务器文本=面板的OnClick =的button1_Click/>
< /&的ContentTemplate GT;
< / ASP:的UpdatePanel>
< / ASP:面板>
< ASP:ModalPopupExtender ID =modalExtender=服务器PopupControlID =Panel1的
的TargetControlID =Button2的>
< / ASP:ModalPopupExtender>
在另一方面,我补充说,在模式弹出扩展按钮code座:
保护无效的button1_Click(对象发件人,EventArgs的发送)
{
字符串脚本=的document.getElementById(;
脚本+ =';
脚本+ = Panel1.ClientID;
脚本+ =';
脚本+ =)的style.display ='无'。
ScriptManager.RegisterStartupScript(这一点,this.GetType(),A,剧本,真);
System.Threading.Thread.Sleep(2000);}
非常感谢亚太区首席技术官Matt夏尔马,他的回答通过有用链接一个类似的问题:
http://forums.asp.net/t/1552551.aspx
I have an issue that I can't display my update progress GIF image when I click button in Modal Pop Extender
the Aspx Code is :
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<img src="ajax-loader.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button2" runat="server" Text="Button" />
<asp:Panel ID="Panel1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</asp:Panel>
<asp:ModalPopupExtender PopupControlID="Panel1" TargetControlID="Button2" ID="mpeConfirm"
runat="server">
</asp:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
and in the code behind I wrote that simple code to be able to display the Progress :( :
protected void Button1_Click(object sender, EventArgs e)
{
Thread.Sleep(2000);
}
After 1 day of googling. I made it :) .The solution was easy and really marvelous .
First, I made a simple modification in the designer. I just moved the update panel inside Modalpop Extender panel control like the following:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<img src="ajax-loader.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:Button ID="Button2" runat="server" Text="Button" />
<asp:Panel ID="Panel1" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="panel" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<asp:ModalPopupExtender ID="modalExtender" runat="server" PopupControlID="Panel1"
TargetControlID="Button2">
</asp:ModalPopupExtender>
On the other hand, I added that code block on the Modal Pop Extender Button:
protected void Button1_Click(object sender, EventArgs e)
{
string script ="document.getElementById(";
script += "'";
script+=Panel1.ClientID;
script += "'";
script+=").style.display='none';";
ScriptManager.RegisterStartupScript(this, this.GetType(), "A",script , true);
System.Threading.Thread.Sleep(2000);
}
Many thanks to "Hitesh Sharma" and his reply to a similar issue through that useful link : http://forums.asp.net/t/1552551.aspx
这篇关于更新进度GIF图像不能显示当我点击模态弹出扩展按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!