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

close radwindow without refresh

5 Answers 220 Views
Window
This is a migrated thread and some comments may be shown as answers.
shervinrv
Top achievements
Rank 1
shervinrv asked on 30 Jul 2014, 11:13 AM
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

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 31 Jul 2014, 05:41 AM
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.
0
shervinrv
Top achievements
Rank 1
answered on 31 Jul 2014, 09:19 AM
Thank You Shinu for your attention
it close the window but still refresh the page
0
Shinu
Top achievements
Rank 1
answered on 01 Aug 2014, 07:01 AM
Hi shervinrv,

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

Thanks,
Shinu.
0
Nicolaï
Top achievements
Rank 2
answered on 29 Oct 2015, 04:08 PM

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.

0
Marin Bratanov
Telerik team
answered on 30 Oct 2015, 09:31 AM

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
Tags
Window
Asked by
shervinrv
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
shervinrv
Top achievements
Rank 1
Nicolaï
Top achievements
Rank 2
Marin Bratanov
Telerik team
Share this question
or