I created a radtoolbar AT RUNTIME
But the javascript $find method does not find it.
That is the javascript code:
function pesquisar(e) {
if (e.keyCode == 13)
{
//radtoolbar is a runtime created RadToolBar
//but can´t be found...
var toolBar = $find("<%= radtoolbar.ClientID %>");
//here the toolBar IS NULL and causes an error.
var item = toolBar.findItemByText('Pesquisar');
if (Telerik.Web.UI.RadToolBarButton.isInstanceOfType(item)) {
item.click();
}
}
}
I tried the getelementbyid method, but this does not return a Telerik.Web.UI.RadToolBarButton, but a [ObjectHtml DivElement].
So, the toolBar.findItemByText('Pesquisar') can´t be executed.
the javascript code:
function pesquisar(e) {
if (e.keyCode == 13)
{
// the getElementById does not return a RadToolBarButton
var toolBar = document.getElementById("radtoolbar");
var item = toolBar.findItemByText('Pesquisar');
if (Telerik.Web.UI.RadToolBarButton.isInstanceOfType(item)) {
item.click();
}
}
}
But when I use a design time RadToolBar created, the $find method works fine