This is a migrated thread and some comments may be shown as answers.

RadWindow double postback issue

3 Answers 125 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 01 Feb 2013, 05:20 PM

Hello,

When opening a RadWindow via .setUrl and .show(), two postbacks are envoked on the destination page, one for .setUrl and one for .show().

Is it possible to only cause one postback?

Below is sample code:

I cannot use navigateUrl of RadWindow because I need to pass querystring values.

I cannot use radopen() function because of styling issues.

RadWindowDoublePostback.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadWindowDoublePostback.aspx.cs" Inherits="WebApplication1.RadWindowDoublePostback" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

        </telerik:RadScriptManager>

        <asp:Button Text="ShowWindow" runat="server" ID="Button1" OnClientClick="showWindow(); return false;"/>

        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">

            <Windows>

                <telerik:RadWindow ID="RadWindow1" runat="server" ReloadOnShow="true">

                </telerik:RadWindow>

            </Windows>

        </telerik:RadWindowManager>

        <script type="text/javascript">

            function showWindow() {

                //var oWnd = radopen("RadWindowCloseDialog.aspx", "RadWindow1");

                var oWnd = $find("<%= RadWindow1.ClientID %>");

                if (oWnd) {

                    oWnd.setUrl('<%= ResolveUrl("RadWindowDoublePostbackDiaolog.aspx") %>');

                    oWnd.show();

                }

            }

        </script>

    </div>

    </form>

</body>

</html>


RadWindowDoublePostbackDiaolog.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadWindowDoublePostbackDiaolog.aspx.cs" Inherits="WebApplication1.RadWindowDoublePostbackDiaolog" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        RadWindowDoublePostbackDiaolog

    </div>

    </form>

</body>

</html>

Is it possible to only cause one postback when I open the window?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 04 Feb 2013, 01:11 PM
Hello Kevin,

You can remove the ReloadOnShow property of the control. Its purpose is to get a fresh copy of the page in the RadWIndow each time it shows, which is why it generates another request for it.


Kind regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Kevin
Top achievements
Rank 1
answered on 05 Feb 2013, 02:15 PM
Marin,

I need to have the ReloadOnShow property turned on because I have other funcionality that requires me to show the latests information on the modal window.

From debugging the code, a new postback is generated on .setUrl and another postback on .show().

Just as a recap, the issue is when the window is opened.

thanks.
0
Marin Bratanov
Telerik team
answered on 07 Feb 2013, 02:47 PM
Hi Kevin,

These are not postbacks, but GET requests. The purpose of the ReloadOnShow property is to get a new copy of the page. You cannot both have it enabled and non-functional. If you need to use the same RadWindow for two different purposes you can always use a second instance that does not have the reload on show set for common pages. The window manager can generate a popup on the fly without additional code: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html.

Nevertheless, if this fits your scenario you can temporarily disable the reloadonshow:
oWnd.set_reloadOnShow(false);
oWnd.setUrl('<%= ResolveUrl("RadWindowDoublePostbackDiaolog.aspx") %>');
oWnd.show();
oWnd.set_reloadOnShow(true);



All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Kevin
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Kevin
Top achievements
Rank 1
Share this question
or