Close a Radwindow using javascript with in a radbutton Click

5 posts, 1 answers
  1. Naveen kumar
    Naveen kumar avatar
    22 posts
    Member since:
    Dec 2011

    Posted 08 Nov 2012 Link to this post

    Hi Experts,

                     I need some help for closing a radwindow using javascript when a radbutton is clicked present in the radwindow itself.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Nov 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Naveen kumar
    Naveen kumar avatar
    22 posts
    Member since:
    Dec 2011

    Posted 08 Nov 2012 Link to this post

    Hi Princy,

                     It Worked Perfectly,Thank You.
  5. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 03 Dec 2014 in reply to Naveen kumar Link to this post

    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

  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 03 Dec 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017