Hello,
I've a RadPanelBar on a dynamiclly loaded UserControl. In that UserControl I've placed a RadScriptBlock where my javascript functions are defined. I'm trying to execute the get_element() and/or get_items() functions but I always get the error that the function is not supported.
With this code the PanelBar object can be found only the function get_items() will not be excuted because it tells me that this function is not support for the element.
Can someone help me with this?
Regards,
Jos Meerkerk,
I've a RadPanelBar on a dynamiclly loaded UserControl. In that UserControl I've placed a RadScriptBlock where my javascript functions are defined. I'm trying to execute the get_element() and/or get_items() functions but I always get the error that the function is not supported.
var
$ = $telerik.$;
var
categoryPanelBar = $(
this
).find(
"<%=RadPanelBar1.ClientID%>"
);
alert(categoryPanelBar.get_items());
With this code the PanelBar object can be found only the function get_items() will not be excuted because it tells me that this function is not support for the element.
Can someone help me with this?
Regards,
Jos Meerkerk,
6 Answers, 1 is accepted
0
Hello Jos,
You get the following error since the jQuery find method accepts either a selector, a jQuery object or an element while in your case you use none of the just mentioned ones. However, using the following code you can achieve the desired effect:
Please note that we would recommend that you use our flexible client-side API.
Regards,
Kate
the Telerik team
You get the following error since the jQuery find method accepts either a selector, a jQuery object or an element while in your case you use none of the just mentioned ones. However, using the following code you can achieve the desired effect:
<telerik:RadScriptBlock runat=
"server"
ID=
"block1"
>
<script type=
"text/javascript"
>
function
pageLoad() {
var
categoryPanelBar = $find(
"<%=RadPanelBar1.ClientID%>"
);
var
item = categoryPanelBar.findItemByText(
"item1"
);
item.disable();
}
</script>
</telerik:RadScriptBlock>
Please note that we would recommend that you use our flexible client-side API.
Regards,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
RvdGrint
Top achievements
Rank 1
answered on 20 Jan 2012, 10:59 AM
Kate,
thnx for your reply but unfortunately this doesn't work.
When I use:
thnx for your reply but unfortunately this doesn't work.
When I use:
var
categoryPanelBar = $find(
"<%=RadPanelBar1.ClientID%>"
);
then categorypPanelBar is null
But when I use:
var
categoryPanelBar = $(
this
).find(
"<%=RadPanelBar1.ClientID%>"
);
an [object] is found
But stil the methods are not valid for the object.
The problem occurs with implementing the Telerik Schedule example with WebServices (http://demos.telerik.com/aspnet-ajax/scheduler/examples/webservice/defaultcs.aspx) on a Dynamiclly loaded User Control.
Regards,
Jos
0
Hello Jos,
Please refer to the attached runnable page that works as expected from my end (I can find the RadPanelBar object and access its properties). Can you modify it in a way so that it demonstrates the issue so I can help you out?
All the best,
Kate
the Telerik team
Please refer to the attached runnable page that works as expected from my end (I can find the RadPanelBar object and access its properties). Can you modify it in a way so that it demonstrates the issue so I can help you out?
All the best,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
RvdGrint
Top achievements
Rank 1
answered on 23 Jan 2012, 08:20 AM
Kate,
as mentioned before my User Control is loaded dynamically. Could that be the difference??
I will try you're example.
Regards,
Jos Meerkerk
as mentioned before my User Control is loaded dynamically. Could that be the difference??
I will try you're example.
Regards,
Jos Meerkerk
0
RvdGrint
Top achievements
Rank 1
answered on 23 Jan 2012, 08:42 AM
Kate,
with your example everything work's fine. Is there an explanation for the fact that things do not work when implementing it in my application?
Regards,
Jos
with your example everything work's fine. Is there an explanation for the fact that things do not work when implementing it in my application?
Regards,
Jos
0
Hello Jos,
Attached is a sample project which uses the following approach to find a client object of a control which is placed inside a user control:
I hope this helps.
Greetings,
Ivana
the Telerik team
Attached is a sample project which uses the following approach to find a client object of a control which is placed inside a user control:
function
pageLoad() {
var
paneljQuery = $telerik.$(
"[id$='_RadPanelBar1']"
);
var
panelBarObj = $find(paneljQuery.attr(
"id"
));
alert(
"The PanelBar Object: "
+ panelBarObj.get_id());
alert(
"The number of items: "
+ panelBarObj.get_items().get_count());
}
var
paneljQuery = $telerik.$(
"[id$='_RadPanelBar1']"
);
-- finds the jQuery object of a control which ID ends on the '_RadPanelBar1'
string. $find(paneljQuery.attr(
"id"
));
-- finds the client object of the control which ID is passed as a parameter.I hope this helps.
Greetings,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now