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

Close Radwindow popup

1 Answer 419 Views
Window
This is a migrated thread and some comments may be shown as answers.
abhijit
Top achievements
Rank 1
abhijit asked on 28 Jul 2011, 09:43 AM
hi i am using windowmanager and radwindow to popup one div from same page.

i am able to display div as popup. but now i have one button on popup and onclicking which popuo window should close.

i tried most solutions which i got in forum but none is working.

<telerik:RadWindowManager ID="winmanParolee" runat="server" ReloadOnShow="false"
            VisibleOnPageLoad="false" KeepInScreenBounds="true">
            <Windows>
                <telerik:RadWindow ID="winPopup" runat="server" OpenerElementID="Button1" ShowContentDuringLoad="true"
                    KeepInScreenBounds="true" Modal="true" Width="600px" Height="400px">
                    <ContentTemplate>
                    <script type= "text/javascript">
                     
                         function Close() {
                                GetRadWindow().Close();
                            }    
  
                            function GetRadWindow() {
                                var oWindow = null;
                                if (window.radWindow)
                                    oWindow = window.radWindow; 
                                else if (window.frameElement.radWindow)
                                    oWindow = window.frameElement.radWindow;       
                                return oWindow;
                            }
                               
                         </script>
                        <div>
                            My dialog content here...
                            <telerik:RadSchedulerRecurrenceEditor ID="RadSchedulerRecurrenceEditor1" runat="server">
                            </telerik:RadSchedulerRecurrenceEditor>
                            <asp:Button ID="Button3" runat="server" Text="Close" OnClick="close_click" />
                        </div>
                    </ContentTemplate>
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>

and on server side i tried both options but not able to work .

protected void close_click(object sender, EventArgs e)
       {
                     Label1.Text = "<script type='text/javascript'>Close()</" + "script>";
           
          // Page.ClientScript.RegisterStartupScript(this.GetType(), "", "Close()",true);
       }

waiting for your reply.

Thanks in advance

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 28 Jul 2011, 04:20 PM
Hi Abhijit,

When you are using the ContentTemplate of the RadWIndow the controls inside are actually still a part of the main page, so you can access them direclty and you do not need this function that you are trying to inject, as it is used to get a reference to the RadWindow from within a page loaded in  the RadWindow (thus an ifame). Please examine the following online demo for more information on the differences: http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx. In short the JavaScript you need is similar to this:
$find("winPopup").close();

which you can attach to the OnCilentClick handler of the button and cancel the postback by returning false.

Regards,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Window
Asked by
abhijit
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or