Ajax + window modal

2 posts, 1 answers
  1. Zbigniew Kozłowski
    Zbigniew Kozłowski avatar
    60 posts
    Member since:
    Apr 2010

    Posted 24 Oct 2010 Link to this post

    i've got a question, because im new to asp.net. Im trying to port mine app from WPF to ASP.NET, but got few issues. Im doing full ajax app, and i dont know how to achiv such scenario:

    1. Default.aspx with RadWindowManager and a DIV that will contain website later.
    2. Login.aspx just a form with login, pass and a button (it appears in RadWindow)
    3. xxxx.aspx after successful login

    so basicly in Default.cs i got 

    protected void Page_Load(object sender, EventArgs e)
                SessionUser sessionUser = (SessionUser)Session["User"];
                if (sessionUser == null)

    ShowLoginWindow() just open a RadWindow and till that everything works fine. Than in Login.aspx i use RadAjaxManager with button control to get click. Mine question starts here
    1. How can i close RadWindow form code-behind.
    2. How can i know at code-behind Default.cs that Login Window is closed, so i can load a site into DIV?

    Also how do you use modal window? Im not talking about lock screen, because there is a bool to make modal or not, but how can i do something at code-behind, than forward data to modal window, get data from window and continue to execute code.
    Something like:

    Window window = new Window();
    window.MineString = "Something";

    Ofc i know it cant be achiv like i did, but need something for such scenario.

    Thanks, for help.
  2. Answer
    Georgi Tunev
    Georgi Tunev avatar
    7207 posts

    Posted 26 Oct 2010 Link to this post

    Hello Zbigniew,

    Straight to your questions:
    1. To close a RadWindow from within the content page, you need to get a reference to it and then call its close() method - basically, in the same way as you would do that with a standard popup. The only difference is that to get a reference to the RadWindow, you need to use the GetRadWindow() function instead of using the window object.
      function GetRadWindow()
        var oWindow = null;
        if (window.radWindow)
           oWindow = window.radWindow;
        else if (window.frameElement.radWindow)
           oWindow = window.frameElement.radWindow;
        return oWindow;
      function closeWin()
          var oWnd = GetRadWindow();
    2. RadWindow is created and handled on the client - it doesn't have a server-side event fired when it is closed (if it did, you would have to make trips to the server on every closing). If you want to fire a server-side event when a RadWindow is closed, you could use the OnClientClose property. There you could set a name of a JavaScript function that will be fired once the window is closed. In that JS function, you could use __doPostBack() or RadAjax's ajaxRequest call.

    Best wishes,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top