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

Close a Radwindow using javascript with in a radbutton Click

4 Answers 2814 Views
Window
This is a migrated thread and some comments may be shown as answers.
Naveen kumar
Top achievements
Rank 1
Naveen kumar asked on 08 Nov 2012, 10:16 AM
Hi Experts,

                 I need some help for closing a radwindow using javascript when a radbutton is clicked present in the radwindow itself.

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 Nov 2012, 10:40 AM
Hi Naveen,

Try the following code snippet to achieve your scenario.

ASPX:
<telerik:RadWindow ID="RadWindow1" runat="server" >
    <ContentTemplate>
        <telerik:RadButton Id="RadButton1" runat="server" AutoPostBack="false"  OnClientClicked="OnClientClicked"></telerik:RadButton>
    </ContentTemplate>
</telerik:RadWindow>

JS:
<script type="text/javascript">
    function OnClientClicked(sender, args) {
        var window= $find('<%=RadWindow1.ClientID %>');
        window.close();
    }
</script>

Hope this helps.

Regards,
Princy.
0
Naveen kumar
Top achievements
Rank 1
answered on 08 Nov 2012, 10:51 AM
Hi Princy,

                 It Worked Perfectly,Thank You.
0
Dhamodharan
Top achievements
Rank 1
answered on 03 Dec 2014, 08:21 AM
Hi Princy,

I am created radwindow dynamically, so i dont know the radwindow id. i am getting button client id when button click event like "ctl14_rwNotes_2_C_rbNotesConfirm". how to get radwindow id from this one. i dont like to replace button id is empty, because i am using this radwindow as user control. Please help how to get radwindow id from button onclint click event. this button inside that radwindow. i remove the cancel button based on our requirement. when click that button i save the data into database after that i want close that together. Please give your suggestions

Thanks in advance,
Dhamu

0
Marin Bratanov
Telerik team
answered on 03 Dec 2014, 12:48 PM

Hi Dhamu,

This article shows how to get a reference to the RadWIndow from inside its content template: http://www.telerik.com/help/aspnet-ajax/window-client-side-basics.html#referece-from-content-template.

Other options you have are to traverse the DOM tree until you find the div.RadWindow that, so you can get its id attribute and remove the RadWindowWrapper_ prefix, so you can get the actual ID of the script control that you can use for $find().


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Naveen kumar
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Naveen kumar
Top achievements
Rank 1
Dhamodharan
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or