Rectangle 27 0

asp.net how to close radwindow without refreshing parent?


Actually Telerik's support is pretty good on these matters (one of the best i've seen) and you should post your question in their forum if you do not get anything favorable here.

Have you added a OnClientClose javascript to take the control from the open window?

Note
Rectangle 27 0

asp.net how to close radwindow without refreshing parent?


<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

<script type="text/javascript">

    //mandatory for the RadWindow dialogs functionality
    function getRadWindow() {
    if (window.radWindow) {
        return window.radWindow;
    }
    if (window.frameElement && window.frameElement.radWindow) {
        return window.frameElement.radWindow;
    }
    return null;
    }

    // Fires when the changes are saved
    function onClientClose(arg) {
        // Pass the arguments from the dialog to the callback function on the main page.    
        getRadWindow().close(arg);
    }
    </script>

</telerik:RadCodeBlock>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" DestroyOnClose="true" Width="750px" Height="500px" OnClientClose="onClientClose">
    <windows>
<telerik:RadWindow ID="RadWindow1" runat="server">
</telerik:RadWindow>
    </windows>
</telerik:RadWindowManager>
<%-- RadAjaxManager --%>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <ajaxsettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
    <UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxManager1" />
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
    </UpdatedControls>
</telerik:AjaxSetting>       
    </ajaxsettings>
</telerik:RadAjaxManager>

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

    <script type="text/javascript">

// Insert in RadWindow
function showForm(url) {
    window.radopen(url, "RadWindow1");
    return false;
}


function onClientClose(oWnd, args) {
    // get the transferred arguments
    var arg = args.get_argument();
    if (arg == '' || arg == null) {
// No need to refresh RadGrid
    }
    else {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
    }
}


    </script>

</telerik:RadCodeBlock>
protected void ChildSave_Click(object sender, EventArgs e)
{

    ClientScriptManager cs = Page.ClientScript;

    cs.RegisterStartupScript(typeof(Page), "CloseScript_" + UniqueID,
      "onClientClose('1');", true); // Return value 1 to parent

}
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    var result = Int32.Parse(e.Argument); // return argument from child
}
Note
Rectangle 27 0

asp.net how to close radwindow without refreshing parent?


Actually Telerik's support is pretty good on these matters (one of the best i've seen) and you should post your question in their forum if you do not get anything favorable here.

Have you added a OnClientClose javascript to take the control from the open window?

Note
Rectangle 27 0

asp.net how to close radwindow without refreshing parent?


As Bumble Bee said, you most probably have either a function hooked to OnClientClose that submits the page, or you are calling something like GetRadWindow().BrowserWindol.location.reload() from the content page.

What you could do is to fire an Ajax request on the parent page, that will use RadAjaxManager's client-side API to fire an Ajax request, which will get you the data on the server. A scenario, similar to yours is shown in this demo. In it, when a RadWindow is closed (in the content page), we call a JavaScript function in the parent page, that fires the Ajax request via RadAjaxManager and rebinds the grid on the server - all is done without postbacks. Check these help articles for more information on the subject:

You say however, that you want to have the value in parent's page code behind. To do this, you will have to make a trip to the server. Since you don't want to reload the page, the easiest way to do this is to use Ajax - and if you are using RadControls, there is a RadAjaxManager to help you in this task :)

Note
Rectangle 27 0

asp.net how to close radwindow without refreshing parent?


As Bumble Bee said, you most probably have either a function hooked to OnClientClose that submits the page, or you are calling something like GetRadWindow().BrowserWindol.location.reload() from the content page.

What you could do is to fire an Ajax request on the parent page, that will use RadAjaxManager's client-side API to fire an Ajax request, which will get you the data on the server. A scenario, similar to yours is shown in this demo. In it, when a RadWindow is closed (in the content page), we call a JavaScript function in the parent page, that fires the Ajax request via RadAjaxManager and rebinds the grid on the server - all is done without postbacks. Check these help articles for more information on the subject:

You say however, that you want to have the value in parent's page code behind. To do this, you will have to make a trip to the server. Since you don't want to reload the page, the easiest way to do this is to use Ajax - and if you are using RadControls, there is a RadAjaxManager to help you in this task :)

Note
Rectangle 27 0

asp.net how to close radwindow without refreshing parent?


<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

<script type="text/javascript">

    //mandatory for the RadWindow dialogs functionality
    function getRadWindow() {
    if (window.radWindow) {
        return window.radWindow;
    }
    if (window.frameElement && window.frameElement.radWindow) {
        return window.frameElement.radWindow;
    }
    return null;
    }

    // Fires when the changes are saved
    function onClientClose(arg) {
        // Pass the arguments from the dialog to the callback function on the main page.    
        getRadWindow().close(arg);
    }
    </script>

</telerik:RadCodeBlock>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" DestroyOnClose="true" Width="750px" Height="500px" OnClientClose="onClientClose">
    <windows>
<telerik:RadWindow ID="RadWindow1" runat="server">
</telerik:RadWindow>
    </windows>
</telerik:RadWindowManager>
<%-- RadAjaxManager --%>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <ajaxsettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
    <UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxManager1" />
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
    </UpdatedControls>
</telerik:AjaxSetting>       
    </ajaxsettings>
</telerik:RadAjaxManager>

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

    <script type="text/javascript">

// Insert in RadWindow
function showForm(url) {
    window.radopen(url, "RadWindow1");
    return false;
}


function onClientClose(oWnd, args) {
    // get the transferred arguments
    var arg = args.get_argument();
    if (arg == '' || arg == null) {
// No need to refresh RadGrid
    }
    else {
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
    }
}


    </script>

</telerik:RadCodeBlock>
protected void ChildSave_Click(object sender, EventArgs e)
{

    ClientScriptManager cs = Page.ClientScript;

    cs.RegisterStartupScript(typeof(Page), "CloseScript_" + UniqueID,
      "onClientClose('1');", true); // Return value 1 to parent

}
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    var result = Int32.Parse(e.Argument); // return argument from child
}
Note