Search code examples
asp.netvb.netrefreshreloadframeset

Refresh page with framesets on button click


I have a web application built around a frameset. The main page (with the frameset layout) is index.aspx. After the user logs in, if there are any alerts it redirects the main content frame to an alerts page with a confirmation button on it. When they click this button I want the index.aspx to be reloaded. If I use the response.redirect("index.aspx") on button click it reloads the main content frame with another frameset.

The server-side button click sets a flag within the database so that the user doesnt see the alert again.

My question is how do I force a complete reload of the entire frameset?


Solution

  • Get rid of them if you can, but until then you will have to do it with JavaScript:

    *sorry about the c# example, don't care for 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);
    }