Close Radwindow From Server Side

2 posts, 0 answers
  1. Raymond
    Raymond avatar
    53 posts
    Member since:
    Aug 2007

    Posted 25 Mar 2009 Link to this post

    I have opened a radwindow. Inside this window, there is a proxy manager to refresh the page when save button is click. I wish to close the window when delete button is click once the server code has removed the record from database. However, this does not work.

    The Coding on clicking the delete button is as follows 

     

    string JS = "<script type=text/javascript>";

     

    JS +=

    "function GetRadWindow1(){";

     

    JS +=

    "var oWindow = null;";

     

    JS +=

    "if (window.radWindow) oWindow = window.radWindow;";

     

    JS +=

    "else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;";

     

    JS +=

    "return oWindow;}";

     

    JS +=

    "var oWindow = GetRadWindow1();";

     

    JS +=

    "oWindow.Close();";

     

    JS +=

    "oWindow.BrowserWindow.refreshGrid();";

     

    JS +=

    "</script>";

     

    RegisterStartupScript(

    "CloseWindowStartupScript", JS);

    I have tried this method and is still not working

     

    lblClose.Text=

    "<script type='text/javascript'>GetRadWindow().Close();GetRadWindow().BrowserWindow.refreshGrid();</script>";

     

     


    BUT When I remove the proxy manager in this window. Everything works. Any resolution to this issue?

  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 26 Mar 2009 Link to this post

    Hello Raymond,

    When working with Ajax, you need to use the RegisterStartupScript method of the ScriptManager or ResponceScripts collection of the RadAjaxManager.

    More information on the subject (calling JavaScript function in Ajax environment) is available in various resources in the Net. You could also check the following KB that shows how to call radalert() from server - the idea of the approaches described there is the same:
    http://www.telerik.com/support/kb/aspnet-ajax/window/calling-radalert-from-codebehind.aspx



    Best wishes,
    Georgi Tunev
    the Telerik team

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