【问题标题】:Refresh page with framesets on button click单击按钮时刷新带有框架集的页面
【发布时间】:2011-12-29 17:02:53
【问题描述】:

我有一个围绕框架集构建的 Web 应用程序。主页(带有框架集布局)是 index.aspx。用户登录后,如果有任何警报,它会将主要内容框架重定向到带有确认按钮的警报页面。当他们单击此按钮时,我希望重新加载 index.aspx。如果我在按钮上使用 response.redirect("index.aspx") 单击它会用另一个框架集重新加载主要内容框架。

服务器端按钮单击会在数据库中设置一个标志,以便用户不会再次看到警报。

我的问题是如何强制重新加载整个框架集?

【问题讨论】:

    标签: asp.net vb.net refresh reload frameset


    【解决方案1】:

    如果可以的话,摆脱它们,但在那之前你必须使用JavaScript

    *对不起 c# 示例,不关心 vb.net

    How to do a Response.Redirect to another frame

    //add this startup script to your button event handler
    String csname1 = "FrameRedirect";  
    Type cstype = this.GetType();
    
    // Get a ClientScriptManager reference from the Page class.
    ClientScriptManager cs = Page.ClientScript;
    
    // Check to see if the startup script is already registered.
    if (!cs.IsStartupScriptRegistered(cstype, csname1))
    {
      string url = "index.aspx";
      String cstext1 = "parent.framename.location.href='" + url + "';"
      //or
      //String cstext1 = "parent.framename.location.replace('" + url + "');"
      cs.RegisterStartupScript(cstype, csname1, cstext1, true);
    }
    

    【讨论】:

    • 谢谢我在您回答后发现 (Response.Write("");)。再次感谢您
    猜你喜欢
    • 2014-04-10
    • 2015-07-05
    • 2013-10-10
    • 2016-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多