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

RadWindow Close Button ID Problem

7 Answers 141 Views
Window
This is a migrated thread and some comments may be shown as answers.
Oguzhan
Top achievements
Rank 1
Oguzhan asked on 16 Oct 2011, 04:47 PM
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() {

            }


        });

7 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 18 Oct 2011, 01:14 PM
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.
0
Oguzhan
Top achievements
Rank 1
answered on 18 Oct 2011, 01:46 PM
I will write to this code

<script>

</script> blocks??
0
Oguzhan
Top achievements
Rank 1
answered on 18 Oct 2011, 01:48 PM
It doesn't work :(
0
Oguzhan
Top achievements
Rank 1
answered on 24 Oct 2011, 04:45 PM
Any suggestion ?
0
Kevin
Top achievements
Rank 2
answered on 26 Oct 2011, 01:22 PM
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.
0
Salvador Fernández
Top achievements
Rank 1
answered on 13 Feb 2012, 01:24 PM
And ¿what about this?

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

...
0
Svetlina Anati
Telerik team
answered on 13 Feb 2012, 02:47 PM
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 >>
Tags
Window
Asked by
Oguzhan
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Oguzhan
Top achievements
Rank 1
Salvador Fernández
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or