Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Window > Getting value from RadWindow when user presses [X] close window button

Not answered Getting value from RadWindow when user presses [X] close window button

Feed from this thread
  • Simone avatar

    Posted on Feb 2, 2012 (permalink)

    Using javascript, 

    I need to get the value of a TextBox that's in a RadWindow when the user presses X Close button:

            function OnClientBeforeClose(sender, args) {
    ???how do I get the RadWindow1 TextBox1 value ???
            }

    Reason is, I need to refresh the parent page based on that value after the user hits the X Close button.

    How do I do that?
    Thanks.

    Reply

  • Posted on Feb 2, 2012 (permalink)

    Hello,

    please check below link.

    Window / Returning Values from a Dialog

    Thanks,
    Jayesh Goyani

    Reply

  • Simone avatar

    Posted on Feb 2, 2012 (permalink)

    I just figured out how to do this.
    I'm posting the code here, it might help someone.

    I looked up the client script reference, and The RadWindow has a property called "argument" , and that was the key!
    I can pass in the argument to the parent window using this.


    //Client Window JavaScript:

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

    //Client Window C#
            protected void OnMyEvent (object sender, EventArgs args)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ReloadRepSessions", "SetArgumentValue(" + "'ThisIsMyArgument'" + ");", true);
            }

    //Parent Page Javascript

            function OnClientBeforeClose(oWnd, args) {
                var oWnd = $find("<%= RadWindow1.ClientID %>");
                var arg = oWnd.argument;

    ...
    //reload control on parent
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
    ....
            }

    <telerik:RadWindow  .... OnClientBeforeClose="OnClientBeforeClose"

    //Parent Page c# code
            protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
            {
                switch (e.Argument)
                {
    case "ThisIsMyArgument" ....


    Hope this helps someone later.




    Reply

  • Simone avatar

    Posted on Feb 2, 2012 (permalink)

    Thanks Jayesh, but that example uses the arguments passed on "OnClientClose" and that was not what I was looking for.

    What I was looking for was a way to get the argument before the window closes, when the user presses the X close button.

    But I figured out a solution for this.

    Thanks,
    Simone

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Window > Getting value from RadWindow when user presses [X] close window button
Related resources for "Getting value from RadWindow when user presses [X] close window button"

ASP.NET Window Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]