Custom Response.Write on Session Timeout

4 posts, 0 answers
  1. Jon A.
    Jon A. avatar
    32 posts
    Member since:
    Feb 2003

    Posted 10 Apr 2009 Link to this post

    Hi,

    My web app uses several radWindows that return a parameter to the parent window via a callback JS function.  These work fine, but I'd like to improve the current behavior with error trapping code that can close the form before the entire ASPX page is sent to the browser.

    In the ASPX pages displayed by the radWindow, I'd like to start trapping for session time-out and other conditions within the page_load event.  To optimize performace, I'd like to use Response.Write (or Response.WriteFile) to send a custom response (simple HTML form + JS) to the browser that gracefully closes the window, bypassing the load of ASPX page content.  This approach will be much faster than injecting JS into the ASPX page via RegisterStartupScript (or similar method) that invovles the normal ASPX page lifecycle.
    But in order to write a custom response to the browser, I need to ensure the response page includes the necessary Telerik JS libraries that let me (a) close the radWindow and (b) return a value to the parent page.  

    Can you tell me how to do this?  Are there a set of core Telerik JS libraries that I need to include?  Ideally, I can continue using JS functions such as GetRadWindow() in order to close the form, such as:
    var currentWindow = GetRadWindow();
    currentWindow.argument = arg;
    currentWindow.close();

    Thanks.
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 10 Apr 2009 Link to this post

    Hello Jon,

    You do not need to import any libraries into your response. All you need to do is make sure the GetRadWindow function is sent over to the client

    function GetRadWindow() 
      var oWindow = null
      if (window.radWindow) 
         oWindow = window.radWindow; 
      else if (window.frameElement.radWindow) 
         oWindow = window.frameElement.radWindow; 
      return oWindow; 
    }   

    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. Jon A.
    Jon A. avatar
    32 posts
    Member since:
    Feb 2003

    Posted 10 Apr 2009 Link to this post

    Sorry, GetRadWindow was clearly the wrong example of JS loaded by a JS library.

    For your example code to work, don't you need to load a Telerik libarary that dyanamically adds the 'radWindow' property to the 'window' object?

    I will go ahead and try loading a simple HTML into a radWindow to test your suggestion.

    Thanks.
  4. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 13 Apr 2009 Link to this post

    Hi Jon A.,

    The window.radWindow variable has been set to the document inside the RadWindow by the RadWindow itself.
    The RadWindow alraedy has all its scripts because it resides on a different page (e.g the parent page) - while you are dealing with a child page (e.g. the page loaded inside RadWindow). The child page needs nothing else to access the RadWindow object other than the couple of lines of javascript already provided.

    Best wishes,
    Tervel
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top