2010-10-21 152 views
2

我有一个页面不断刷新自己,我想将页面包含到我的主页面。刷新iframe而不刷新父页面

我正在使用iframe将页面包含到我的主页面,但每当iframe中的页面刷新时,它也会刷新我的主页面。如何在自己的框架内刷新iframe并且不影响我的主页面?

还有没有更好的方式来包含页面而不使用iframe?

回答

0

如果您需要刷新页面从背后asp.net代码父页面,你可以注册客户端脚本网页加载运行:

protected void btnOk_Click(object sender, EventArgs e) 
    { 
     //Implement Your logic here..... 
     //.............................. 
     //now refresh parent page and close this window 
     string script = "this.window.opener.location=this.window.opener.location;this.window.close();"; 
     if (!ClientScript.IsClientScriptBlockRegistered("REFRESH_PARENT")) 
      ClientScript.RegisterClientScriptBlock(typeof(string), "REFRESH_PARENT", script, true);   
    } 

How to refresh parent page on child window close上的逐步教程演示了上述功能的使用。

0

我有一个解决办法:

HERE

这实际上重新加载一个iframe每3秒,但它可以很容易地适应您的需求为1次重装,因为基本的原理适用...