Returning values to parent page from rad window.

5 posts, 0 answers
  1. Praveen Addepally
    Praveen Addepally avatar
    4 posts
    Member since:
    Oct 2009

    Posted 05 Oct 2009 Link to this post

    Hello all,
                   I have a common scenario, but i could not implement in a cleaner way.
     
    I have web page which contains a treeview and 2 grid.On clicking each node in tree view shows two grids on right hand side of the treeview populated with values related to the clicked node in treeview. Now on right clicking the node in tree view and selecting a context menu item will open a new rad window for me.

    In the rad window the user will make update/insert/delete operations against database. The user can close this rad window in two ways - one is clicking the 'close' button in rad window
    -second is clicking the 'X' button on top right corner of rad window.

    what i need to do is 'onclientclose' of radwindow, i need to read the arguments that are passed from radwindow and depending on those passed arguments, i have to refresh the treeview as well as the two grids on the parent page. I'm able to achieve this when user clicks 'close' button on radwindow, but when user clicks the 'X' i cannot get the arguments passed back from rad window to parent page. Could anybody please help me in this case?

    when user clicks close button on rad window, this is how i'm closing rad window and passing back arguments

     

     

    var oArg = new Object();

     

    oArg.ReloadGrids = true;

     

    oArg.ReloadTreeView= false;
    RadWindow.close(oArg);

    and on client close this is how i read arguments passed from rad window

     

    function

     

     RadWindow_OnClientClose(oRadWind, args) {

     

     

    //get the transfered arguments

     

     

    var arg = args.get_argument();

     

    }


    Please let me know if you guys need some more info..

     

    cheers!

    pravin.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Oct 2009 Link to this post

    Hi Praveen,

    I tried another approach for passing the parameter to parent window. I tried getting reference to window and set the argument for window object. For each change for the value update the argument value. And in the OnClientClose event, retrieve the argument as shown below.

    window.aspx:
     
    <script type="text/javascript"
        var oWnd; 
        function pageLoad() { 
            oWnd = GetRadWindow(); 
        } 
        function change() { 
            oWnd.argument = "Value"// Update the value 
        } 
        function returnArg() { 
            oWnd.argument = "Hi"// Set the updated value in button click
            oWnd.close(); 
        } 
        function GetRadWindow() { 
            var oWindow = null
            if (window.radWindow) 
                oWindow = window.radWindow; 
            else if (window.frameElement.radWindow) 
                oWindow = window.frameElement.radWindow; 
            return oWindow; 
        }   
    </script> 

    parent.aspx:
     
    <script type="text/javascript"
        function clientClose(oWnd) { 
            var arg = oWnd.argument; 
            alert(arg); 
       } 
    </script> 

    -Shinu.
  3. Praveen Addepally
    Praveen Addepally avatar
    4 posts
    Member since:
    Oct 2009

    Posted 06 Oct 2009 Link to this post

    Hello shinu,
                       I have tried your soln. and it works for me!But instead of calling change() function each time value got changed, do you know a way to call change 'change()' function onclick of 'X' button which is on top right corner of rad window?

    Cheers!
    Pravin.
  4. Pravin Kamane
    Pravin Kamane avatar
    3 posts
    Member since:
    Mar 2010

    Posted 21 May 2010 Link to this post

    Hi, all,
    Thanks for the wonderful sollutions you provide.

    Related to the passing values to the parent Page, I have a querry.

    I am using a Radwindow to host an aspx page, in which the User control is loaded.
    I am able to get the popup properlly, but my problem starts after that.
    Iam passing the parameters back using 
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     

    function CloseWithArg()

    {

            var customArg =  "1,2,3,4,5,6,7,8,9,10";

     

     

            GetRadWindow().close(customArg);

    }
    function GetRadWindow()
    {

     

     

          var oWindow = null;

     

     

     

            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog

     

     

     

               else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)

     

     

     

     

          return oWindow;

     

     

    }
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     


    This usercontrol is hosted in an aspx page, which is hosted using the radwindow. Iam utilising the onclientclose event of the radwindow, but my event is not called. Handling the below function for the event OnClientclose

    function OnClientclose(sender, eventArgs)
     {

     

     

            var arg = eventArgs.get_argument();

     

     

            if (arg) {

     

     

     

                           alert(arg);

     

     

                         }

     

            else {

     

     

                     alert("No Parameters Passed');

     

     

                     }

    }

     

    Do i have to take special care as iam not passing parameters from the aspx page directly, rather from the ascx page.

    Thanks & Regards,
    Pravin.S.Kamane

  5. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 26 May 2010 Link to this post

    Hi Pravin,

    The provided information is not enough for me to determine the exact reason for the behavior that you experience. Could you please open a new support ticket and send me a project which shows your setup. I will check it and do my best to provide a solution as soon as possible.

    All the best,
    Fiko
    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.
Back to Top