Is there a method like GetRadWindowManager for RadToolTipManager as shown in code snippet below?
The goal is to find the RadToolTipManager in an easy and transparent manner like in code below for RadWindowManager in any content page, otherwise one needs to get the id from master page and then use $find, which is not an easy and transparent way of getting the manager object.
var
omanager = GetRadWindowManager();
4 Answers, 1 is accepted
There isn't such a method. If you would like to see one implemented, I suggest you post your request in the feedback portal.
In the meantime, you can use the $telerik.radControls array (http://docs.telerik.com/devtools/aspnet-ajax/controls/telerik-static-client-library) and the isInstanceOfType method to check whether the array element is Telerik.Web.UI.RadToolTipManager.
Regards,
Marin Bratanov
Telerik
Hi Marin,
First of all let me thank you for the super quick response. I wasn't expecting a reply so soon. You are excellent.
I did try the method which you suggested but it does not RadToolTipManager even though its there on the page. You can see a screenshot of this at this URL: http://screencast.com/t/bqWClXZfz10
Thanks
Sunil
Hi Marin,
After some research, I came up with following code to get a radControl object of any type, since $telerik.radControls seems to have some limitations. All three methods seem to be working.
Thanks
Sunil
function
getToolTipManager () {
var
components = Sys.Application.getComponents();
for
(
var
i = 0; i < components.length; i++) {
if
(components[i]
instanceof
Telerik.Web.UI.RadToolTipManager) {
return
components[i];
}
}
return
null
;
}
function
getAllRadGrids () {
var
components = Sys.Application.getComponents();
var
allradgrids = [];
for
(
var
i = 0; i < components.length; i++) {
if
(components[i]
instanceof
Telerik.Web.UI.RadGrid) {
allradgrids.push(components[i]);
}
}
return
allradgrids;
}
function
getAllRadControlObjectsOfType (radControlType) {
var
components = Sys.Application.getComponents();
var
allradcontrolsofAType = [];
for
(
var
i = 0; i < components.length; i++) {
if
(components[i]
instanceof
radControlType) {
allradcontrolsofAType.push(components[i]);
}
}
return
allradcontrolsofAType;
}
Using the above code, one could get RadToolTipManager on a page using JavaScript code as below.
//get the first RadToolTipManager on the current page
var
toolTipManager = getToolTipManager();
//get all RadToolTipManager instances as an array object, on the current page
var
toolTipManagers = getAllRadControlObjectsOfType(Telerik.Web.UI.RadToolTipManager);
Also, one could get radControl of any type using JavaScript like below. The array returned would contain all instances of that radControl type on the current page. It would have been nice if these methods were part of $telerik static library since these utility methods are very useful.
//get all instances of RadGrid on current page
var
allRadGrids = getAllRadControlObjectsOfType(Telerik.Web.UI.RadGrid);
//get all instances of RadGrid on current page
var
allRadGrids = getAllRadControlObjectsOfType(Telerik.Web.UI.RadGrid);
//get all instances of RadAjaxLoadingPanel on current page
var
allRadGrids = getAllRadControlObjectsOfType(Telerik.Web.UI.RadAjaxLoadingPanel);
//get all instances of RadTreeView on current page
var
allRadGrids = getAllRadControlObjectsOfType(Telerik.Web.UI.RadTreeView);