close radwindow without refresh

6 posts, 0 answers
  1. shervinrv
    shervinrv avatar
    10 posts
    Member since:
    May 2007

    Posted 30 Jul 2014 Link to this post

    Hi .
    i'm using radwindows to show a notification .
    when i close this notification with X button windows close normally.
    but when i use OK button page refresh after closing notification
    i whant close notification with OK button without refresh like X button

    <telerik:RadWindowManager ReloadOnShow="false" ID="RadWindowManager1" runat="server"
              EnableShadow="true" style="direction: rtl" EnableViewState="false">
             <Windows>
        <telerik:RadWindow ID="RadWindowPopup" VisibleOnPageLoad="false" EnableShadow="true" Behaviors="Close" AutoSize="false"
             Height="180" Width="330" runat="server" style="direction: rtl" CenterIfModal="false"
             Modal="true" CssClass="radwindowpopup" VisibleStatusbar="false"  >
          <ContentTemplate >
            <div class="popup">
              <div class="popup_l">
               <div ID="PopupIcon" runat="server"></div>
              </div>
              <div class="popup_r" >
                <asp:Literal ID="UserMessage" runat="server" > Message </asp:Literal>
              </div><br></br>
              <div class="clear popup_button">
                <asp:Button ID="Button" runat="server" Text="OK" />
              </div>
            </div>
          </ContentTemplate>
        </telerik:RadWindow>
      </Windows>
              </telerik:RadWindowManager>

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


    Thank You
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 31 Jul 2014 in reply to shervinrv Link to this post

    Hi shervinrv,

    This is the expected behavior. When you click the OK button a full postback is happening and during this process the whole page is reloaded (that's why you see a page refresh) and all the dynamically created objects on the page are destroyed and hence RadWindow is also closed.

    If you want to simply close the RadWindow on clicking the OK button then you can write a JavaScript method to explicitly close the RadWindow and cancel the buttons postback. Please check the following sample code.

    ASPX:
    <asp:Button ID="Button" runat="server" Text="OK" OnClientClick="return closeRadWindow()" />

    JavaScript:
    <script type="text/javascript">
        function closeRadWindow() {
            $find('<%=RadWindowPopup.ClientID %>').close();
            return false;
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. shervinrv
    shervinrv avatar
    10 posts
    Member since:
    May 2007

    Posted 31 Jul 2014 in reply to Shinu Link to this post

    Thank You Shinu for your attention
    it close the window but still refresh the page
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Aug 2014 in reply to shervinrv Link to this post

    Hi shervinrv,

    Unfortunately I couldn't replicate the issue at my end.

    Thanks,
    Shinu.
  6. Nicolaï
    Nicolaï avatar
    160 posts
    Member since:
    Apr 2008

    Posted 29 Oct 2015 Link to this post

    Why are there thousands of threads on something "as simple" as closing a small in-page popup? Nothing works out-of-the-box!

    So many threads on closing radwindows, so many problems, workarounds, using js timeout, etc.

    WHY? (Not how)

    And I thought I would be using the controls to avoid wasting my time on trivial issues.

  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3599 posts

    Posted 30 Oct 2015 Link to this post

    Hello Nicolaï,

    The reason why there are many ways (and many questions) is because there is an infinite number of scenarios RadWindow can be used in. Its content is arbitrary and there are different things this content will do.

    The basics of interacting with a RadWindow are explained in the documentation: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/client-side-programming/overview.

    When custom code is added, however, the scenario can become more complex. For example:

    So, the control works out-of-the-box, but additional code added by the developer may need to be tweaked and in some cases people need assistance with that.

    Regards,

    Marin Bratanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017