RadWindow double postback issue

4 posts, 0 answers
  1. Kevin
    Kevin  avatar
    8 posts
    Member since:
    Nov 2010

    Posted 01 Feb 2013 Link to this post

    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!

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 04 Feb 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin
    Kevin  avatar
    8 posts
    Member since:
    Nov 2010

    Posted 05 Feb 2013 Link to this post

    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.
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 07 Feb 2013 Link to this post

    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.
Back to Top