Stop RadWindow from always loading on page postback

10 posts, 1 answers
  1. A W
    A W avatar
    4 posts
    Member since:
    Jan 2010

    Posted 22 May 2010 Link to this post

    I am invoking a RadWindow as a dialog in my web page.
    I am invoking from code-behind, since I need to pass some parameters:

    radWindow1.NavigateUrl = url  + "?England,Germany,France";
    radWindow1.VisibleOnPageLoad = true;

    This works great, however it keeps reloading on each and every postback.
    How can I stop the RadWindow from reloading? I don't mind code-behind or JavaScript to achieve this.



  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 May 2010 Link to this post

    Hello,

    There are several ways to resolve the problem.

    • Set EnableViewState = "false" for the RadWindowManager
    • Reset the VisibleOnPageLoad property to false with code when suitable, depending on the particular scenario
    • Show the RadWindow through registering a script from the server instead of using server code.

    Also checkout the following forun links which discusses similar scenario.
    RadwindowManger problem
    Radwindow reopening after closing it in every postback

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. A W
    A W avatar
    4 posts
    Member since:
    Jan 2010

    Posted 26 May 2010 Link to this post

    Thanks! Turning off the ViewState worked very well for me.
  5. Yasir
    Yasir avatar
    2 posts
    Member since:
    Dec 2011

    Posted 24 Jan 2012 Link to this post

     
    Set EnableViewState = "false" for the RadWindowManager worked for me when put the RadWindows inside the RadWindowManager.
  6. Mansi
    Mansi avatar
    6 posts
    Member since:
    Apr 2014

    Posted 25 Apr 2014 in reply to Princy Link to this post

    Hi Princy,

    I have tried all solutions. But my radwindow still reloads on each postbacks.
    ASP:
     <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadWindowManager runat="server" EnableViewState = "false">
        <Windows>
       <telerik:RadWindow ID="RadWindow1" Width="500px" Height = "600px" runat="server"  NavigateUrl="~/Customized/CustomizedControls/Member Directory/M_Adv_search.aspx"
       Title="Dialog"  VisibleOnPageLoad = "false">
    </telerik:RadWindow> 
        </Windows>
        </telerik:RadWindowManager>  


     code behind:

      Dim script As String = "function f(){$find(""" + RadWindow1.ClientID & """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
            ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", script, True)  

    Appreciate you help..
    Thanks,

    mansi 
     





















  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 Apr 2014 in reply to Mansi Link to this post

    Hi Mansi,

    Try setting DestroyOnClose="true" for the window. If this doesn't solve the issue, provide your full code snippet.

    ASPX:
    <telerik:RadWindow ID="RadWindow1"  runat="server" VisibleOnPageLoad="false" DestroyOnClose="true">
    </telerik:RadWindow>

    Thanks,
    Princy
  8. Mansi
    Mansi avatar
    6 posts
    Member since:
    Apr 2014

    Posted 28 Apr 2014 in reply to Princy Link to this post

    Hey Princy,

    Thanks for getting back.

    That didnt work.. 

    Is that because I'm using Radwindow in ASCX file ? 

    Thanks again..

    Really appreciate your help..

    Mansi



    here is my code

     ASCX:   M_search.ascx

    <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="M_Search.ascx.vb" Inherits="BusinessManager.M_Search" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>



      <script type="text/javascript" language="javascript">
          function clientShow(sender, eventArgs) {
                   }
                   function clientClose(sender, args) {
                       if (args.get_argument() != null) {
                          alert("'" + sender.get_name() + "'" + " was closed and returned the following argument: '" + args.get_argument() + "'");
                       }
                   }
    </script>
    <p>
        Find a member:</p>

    <br />
    First Name:  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="TextBox1" runat="server" Width="171px" ></asp:TextBox>
    <br />
    <br />
    Last Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="TextBox2" runat="server" Width="176px" ></asp:TextBox>
    <br />
    <br />
    School Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
    <asp:DropDownList ID="DropDownList1" runat="server" Height="16px" 
        Width="174px" >
    </asp:DropDownList>
    &nbsp;<br />
    <br />
    Email Address: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 
    <asp:TextBox ID="TextBox3" runat="server" Width="175px" ></asp:TextBox>
    <p>
        &nbsp;</p>
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadWindowManager runat="server" EnableViewState = "false">
        <Windows>
       <telerik:RadWindow ID="RadWindow1" Width="500px" Height = "600px" runat="server"  NavigateUrl="~/Customized/CustomizedControls/Member Directory/M_Adv_search.aspx"
       Title="Dialog"  VisibleOnPageLoad = "false"  DestroyOnClose="true"  >
    </telerik:RadWindow> 
        </Windows>
        </telerik:RadWindowManager>
       
    <asp:Button ID="btn_advance_search" runat ="server" Text ="Use more detailed search criteria" />
    <br />
    <asp:Button Text="Search Member" runat="server" ID ="btnSearchMember" />
     

    ASCX.vb

    Public Class M_Search
        Inherits System.Web.UI.UserControl
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        End Sub
        Private Sub btn_advance_search_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_advance_search.Click
            Dim script As String = "function f(){$find(""" + RadWindow1.ClientID & """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"

            ' Dim script As String = "  function f() {  var oManager = GetRadWindowManager(); oManager.open(null, """ & RadWindow1.ClientID & """); Sys.Application.remove_load(f);} Sys.Application.add_load(f); "
            ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", Script, True)
        End Sub
    End Class

    The ASPX Page that I'm opening in RadWindow:

    M_adv_search.aspx

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="M_Adv_search.aspx.vb"
        Inherits="BusinessManager.M_Adv_search" %>

    <!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">

    <style type="text/css">
    .yesNoHovered .rbText {
         color: White !important;
    }

    </style>
        <title>Advance Search for members</title>
        <script runat="server">
            Sub Check(ByVal sender As Object, ByVal e As EventArgs)
                Dim i As Integer
                Dim str As String = ""
                For i = 0 To chboxSchoolType.Items.Count - 1
                    If chboxSchoolType.Items(i).Selected Then
                        str = chboxSchoolType.Items(i).Text + ","
                    End If
                Next
            End Sub
        </script>
        <script type="text/javascript">

            function toggle(id) {
                var e = document.getElementById(id);
                if (e.style.display == '')
                    e.style.display = 'none';
                else
                    e.style.display = '';
            }
            var chboxVal = null;
            var i = 0;
            function pageLoad() {
                txtInput = document.getElementById('txtUserInput');
                var currentWindow = GetRadWindow();
                txtInput.value = currentWindow.argument;
            }

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

            function returnArg() {
                var oWnd = GetRadWindow();
                oWnd.close("Some value");
            }
            function cancelAndClose() {
                var oWindow = GetRadWindow();
                oWindow.close(null);
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <br />
        <div>
            <telerik:RadScriptManager ID="Script" runat="server">
            </telerik:RadScriptManager>
            <telerik:RadPanelBar runat="server" ID="RadPanelbar1" Skin="Outlook" ExpandMode="FullExpandedItem"
                Width="450px" Height="520px">
                <Items>
                    <telerik:RadPanelItem Text="Job Function" Expanded="True">
                        <ContentTemplate>
                            <asp:CheckBoxList ID="chboxSchoolJob" AutoPostBack="True" TextAlign="Right" runat="server">
                                <asp:ListItem>Head of School</asp:ListItem>
                                <asp:ListItem>Additional Principals</asp:ListItem>
                                <asp:ListItem>Associate/Assistant Head of School</asp:ListItem>
                                <asp:ListItem>Assistant Head of School</asp:ListItem>
                                <asp:ListItem>School Principal</asp:ListItem>
                                <asp:ListItem>Director of Admissions/Director of Enrollment Management</asp:ListItem>
                                <asp:ListItem>Additional Admissions Staff</asp:ListItem>
                                <asp:ListItem>Director of Institutional Advancement/External Relations</asp:ListItem>
                                <asp:ListItem>Director of Developement</asp:ListItem>
                            </asp:CheckBoxList>
                        </ContentTemplate>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelBar>
            <asp:Button ID="btnClose" Text="Apply Search Criteria" runat="server" OnClientClick="returnArg();" />
        </div>
        </form>
    </body>
    </html>
































    ghg




  9. Mansi
    Mansi avatar
    6 posts
    Member since:
    Apr 2014

    Posted 28 Apr 2014 in reply to Princy Link to this post

    Hey Princy,

    I noticed that it just flickers in Chrome..
    Works good in Firefox and IE.

    any help appreciated..

    Thanks,
    mansi
  10. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Apr 2014 in reply to Mansi Link to this post

    Hi Mansi,

    Please try the following code snippet which works fine at my end.

    ASPX:
    <telerik:RadPanelBar runat="server" ID="RadPanelbar1" Skin="Outlook" ExpandMode="FullExpandedItem"
        Width="450px" Height="520px">
        <Items>
            <telerik:RadPanelItem Text="Job Function" Expanded="True">
                <ContentTemplate>
                    <asp:CheckBoxList ID="chboxSchoolJob" AutoPostBack="True" TextAlign="Right" runat="server">
                        <asp:ListItem>Head of School</asp:ListItem>
                        <asp:ListItem>Additional Principals</asp:ListItem>
                        <asp:ListItem>Associate/Assistant Head of School</asp:ListItem>
                        <asp:ListItem>Assistant Head of School</asp:ListItem>
                        <asp:ListItem>School Principal</asp:ListItem>
                        <asp:ListItem>Director of Admissions/Director of Enrollment Management</asp:ListItem>
                        <asp:ListItem>Additional Admissions Staff</asp:ListItem>
                        <asp:ListItem>Director of Institutional Advancement/External Relations</asp:ListItem>
                        <asp:ListItem>Director of Developement</asp:ListItem>
                    </asp:CheckBoxList>
                </ContentTemplate>
            </telerik:RadPanelItem>
        </Items>
    </telerik:RadPanelBar>
    <asp:Button ID="btnClose" Text="Apply Search Criteria" runat="server" />

    ASPX.VB:
    Protected Sub Page_Load(sender As Object, e As EventArgs)
        Dim control As UserControl = TryCast(LoadControl("M_search.ascx"), UserControl)
        form1.Controls.Add(control)
    End Sub

    ASCX:
    <p>
        Find a member:</p>
    <br />
    First Name:                   
    <asp:TextBox ID="TextBox1" runat="server" Width="171px"></asp:TextBox>
    <br />
    <br />
    Last Name:                   
    <asp:TextBox ID="TextBox2" runat="server" Width="176px"></asp:TextBox>
    <br />
    <br />
    School Name:             
      
    <asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="174px">
    </asp:DropDownList>
     <br />
    <br />
    Email Address:              
    <asp:TextBox ID="TextBox3" runat="server" Width="175px"></asp:TextBox>
    <p>
         </p>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableViewState="false">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" Width="500px" Height="600px" runat="server" NavigateUrl="~/Customized/CustomizedControls/Member Directory/M_Adv_search.aspx"
                Title="Dialog" VisibleOnPageLoad="false" DestroyOnClose="true">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <asp:Button ID="btn_advance_search" runat="server" Text="Use more detailed search criteria"
        OnClientClick="OpenWindow();return false;" />
    <br />
    <asp:Button Text="Search Member" runat="server" ID="btnSearchMember" />

    ASCX JavaScript:
    <script type="text/javascript">
        function OpenWindow() {
            $find("<%=RadWindow1.ClientID %>").show();
        }
    </script>

    Thanks,
    Princy.
  11. Mansi
    Mansi avatar
    6 posts
    Member since:
    Apr 2014

    Posted 29 Apr 2014 in reply to Princy Link to this post

    Thanks Princy,

    I tried that and turned AutoPostBack="False" for all controls in Radpanelbar.

    It works fine.
    Thank you so much,

    Mansi

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017