RadWindow Close Button ID Problem

8 posts, 0 answers
  1. Oguzhan
    Oguzhan avatar
    10 posts
    Member since:
    Sep 2011

    Posted 16 Oct 2011 Link to this post

    I want to see radwindow close button ID but alert is return "null". How can i get close button ID Thanks.

    My codes here:


     
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }



    $(document).ready(function() {

                var Wnd = GetRadWindow();
                alert(Wnd) ; // it is return me "RadWindow id=RDW"
                alert(Wnd.Id); // it is return me "undefined"
                var CloseButton = document.getElementById("CloseButton" +Wnd.Id);

                alert(CloseButton); // it is return me "null"
                CloseButton.onclick = function() {

                }


            });
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 18 Oct 2011 Link to this post

    Hello Oguzhan,

    The reason it doesn't work is because the close button doesn't have an id set. If you want to get the close button you can do it like so:

    Sys.Application.add_load(function(){
    var closeButton = $telerik.$(".rwCloseButton",$find("<%=RadWindow1.ClientID%>").get_popupElement());
    ....
    }

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Oguzhan
    Oguzhan avatar
    10 posts
    Member since:
    Sep 2011

    Posted 18 Oct 2011 Link to this post

    I will write to this code

    <script>

    </script> blocks??
  5. Oguzhan
    Oguzhan avatar
    10 posts
    Member since:
    Sep 2011

    Posted 18 Oct 2011 Link to this post

    It doesn't work :(
  6. Oguzhan
    Oguzhan avatar
    10 posts
    Member since:
    Sep 2011

    Posted 24 Oct 2011 Link to this post

    Any suggestion ?
  7. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 26 Oct 2011 Link to this post

    Hello Oguzhan,

    If you're accessing the RadWindow that the page is contained in, you need to change the code to something like this:

    <script type="text/javascript">
    $telerik.$(document).ready(function(){ 
    var wnd = GetRadWindow();
    var closeButton = $telerik.$(".rwCloseButton",wnd.get_popupElement()); 
    .... 
    }
    </script>

    I hope that helps.
  8. Salvador Fernández
    Salvador Fernández avatar
    3 posts
    Member since:
    Aug 2009

    Posted 13 Feb 2012 Link to this post

    And ¿what about this?

    $telerik.$(document).ready(function(){ 
    var wnd = GetRadWindow();
    var closeButton = wnd._buttonsArray[0];

    ...
  9. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 13 Feb 2012 Link to this post

    Hello guys,

    The buttons array can be used but it is a private property and we strongly recommend to better avoid usage of private properties when you can do that. The reason for that is that we provide for sure backwards compatibility for public API and private one sometimes needs to be changed which can cause issues at a later stage.

    That is why we recommend to get the button by using its class name which is rwCloseButton since despite both the solution will work, the class name one is more reliable.

     

    Kind regards,
    Svetlina Anati
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017