开发者

How to user Ajax UpdateProgress with Iframe in ASP.NET

开发者 https://www.devze.com 2023-03-31 03:23 出处:网络
I ame trying to show a UpdateProgress image with iframe. But it is not working. I am using this iframe to display several pages. My code is as following..

I ame trying to show a UpdateProgress image with iframe. But it is not working. I am using this iframe to display several pages. My code is as following..


        <iframe 
            runat="server" id="Iframe2" height="565" width="100%"   scrolling="no" 
            style="overflow-x:hidden;" fram开发者_StackOverflow社区eborder="0" marginheight="0" marginwidth="0" 
            vspace="0" hspace="0">                
        </iframe>  

     <asp:HiddenField ID="hdfIndex" runat="server" />                         
     </ContentTemplate>
            <Triggers>
                 <asp:AsyncPostBackTrigger ControlID="ibtnPrevious" EventName="Click" />
                 <asp:AsyncPostBackTrigger ControlID="ibtnNext" EventName="Click" />
                 <asp:AsyncPostBackTrigger ControlID="ibtnPage1" EventName="Click" />
                 <asp:AsyncPostBackTrigger ControlID="ibtnPage2" EventName="Click" />
                 <asp:AsyncPostBackTrigger ControlID="ibtnPage3" EventName="Click" />
                 <asp:AsyncPostBackTrigger ControlID="ibtnPage4" EventName="Click" />
                 <asp:AsyncPostBackTrigger ControlID="ibtnPage5" EventName="Click" />
            </Triggers>


But when I use it without iframe then it works nicely.


In my opinion the best way to do this with iframes is to point the iframe to an aspx page having only the responsibility to redirect:

<iframe runat="server" id="Iframe2" height="565" width="100%"   scrolling="no" 
            style="overflow-x:hidden;" frameborder="0" marginheight="0" marginwidth="0" 
            vspace="0" hspace="0" src="Waiting.aspx?page=WebPageTarget.aspx">                
        </iframe>

And, in the Wating.aspx.cs:

protected void Page_Load(object sender, EventArgs e)
{
  var s = Request.QueryString["page"];
  ClientScript.RegisterStartupScript(GetType(), "gotorealpage",
                                     "window.location=\"" + s + "\";", true);
}

Of course, in the Waiting.aspx you put your waiting image.

0

精彩评论

暂无评论...
验证码 换一张
取 消