RadWindow Popup closes automatically a second after opening

5 posts, 0 answers
  1. Josh
    Josh avatar
    7 posts
    Member since:
    May 2012

    Posted 03 Aug 2012 Link to this post

    I am trying to display a page in a RadWindow however the RadWindow closes by its self after about a second of loading the new window. I was hoping someone could look at my code and see if they notice anything wrong. I am new to Telerik so sorry if something seems strange.

    <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
        <script type="text/javascript">
            function openWindow() {      
                var window = $find('<%= crWindow.ClientID %>');
            function onWindowClosed(sender, args) {
                var ajaxManager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
    <telerik:RadWindowManager runat="server" ID="crWindowManager">
            <telerik:RadWindow runat="server" ID="crWindow" Title="test"
                Behaviors="Close,Resize,Move,Maximize" OnClientClose="onWindowClosed" VisibleOnPageLoad="False"
                VisibleStatusbar="False" Modal="true" Width="480px" Height="390px" KeepInScreenBounds="true" ShowContentDuringLoad="true"/>
     <asp:Table ID="tableMasterMCA" runat="server">
                            <asp:LinkButton ID="lnkCR" runat="server">Test</asp:LinkButton>
    I want the window to pop up when the link button is clicked so I also applied some c# code to the link button.

    protected void Page_Load(object sender, EventArgs e)
                lnkCR.Attributes.Add("onclick", "return openWindow()");
                crWindow.NavigateUrl = "~/Pages/CRForm.aspx";
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Aug 2012 Link to this post

    Hi Josh,

    The Radwindow is closing due to the postback generated by the Link Button. Please modify your code as follows to achieve your scenario.

    <script type="text/javascript">
     function openWindow()
      var window = $find('<%= crWindow.ClientID %>');
      return false;

  3. Peter
    Peter avatar
    40 posts
    Member since:
    Mar 2012

    Posted 06 Dec 2012 Link to this post

    I don't understand this behaviour: if I use a RadWindow with a simple anchor tag (onclick) the RadWindow stays open. If I use a RadButton, the window disappears. Why?

    <telerik:GridTemplateColumn HeaderText="Legacy">                                       
                                                <telerik:RadButton runat="server" OnClientClicked="openLegacyPopUp">
                                                    <Icon  PrimaryIconCssClass="rbOpen" />

  4. Marin Bratanov
    Marin Bratanov avatar
    4533 posts

    Posted 07 Dec 2012 Link to this post

    Hello Peter,

    The RadButton performs a postback by default, so you need to prevent it. You can do this by setting its AutoPostBack property to false. The anchor does not postback when clicked (by default).

    On a side note regarding Princy's example - I would advise against using window as a JavaScript variable name because it is a reserved word - the window variable is the default window object the browser offers.

    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.
  5. Arun
    Arun avatar
    3 posts
    Member since:
    Jun 2017

    Posted 15 Jun 2017 in reply to Princy Link to this post

    is there any other option to prevent radwindow from being close automatically. You have used "return false" for that but I cant use that because a have OnClientClick and OnClick bothin my control it dosent execute OnClick event if I return false on OnClientClick
Back to Top