Javascript problems with webservice demo in dynamic usercontrol

2 posts, 0 answers
  1. Roel
    Roel avatar
    2 posts
    Member since:
    Apr 2011

    Posted 17 Jan 2012 Link to this post


    I'm trying to get the RadScheduler demo with webservice binding to work in our application. If i recreate the demo in a new web application on an .aspx page everything works fine. But when i try to recreate it in a user control (which is dynamically loaded in our app) the javascript and jquery functions start acting up.

    it seems the $telerik.$find() function is not working. I've set all scriptreferences that are provided in the demo on my master page but once the function 'addCategoriesToArray' function fires the radPanelBar is not found. i've put the scripts inside a RadScriptBlock so the ClientID's are being resolved nicely.

    The first error i'm getting is: Cannot get the value of the property get_element: the object is null or not defined. This happens inside the following function:
    function addSelectedCategoriesToArray(categoryNamesArray) {
                var $ = $telerik.$;
                var categoryPanelBar = $find('<%=RadPanelBar1.ClientID %>');
                $(':checkbox:checked', categoryPanelBar.get_element()).each(function () {

    The panelbar is right there on the usercontrol and the id is the same as the resolved id the js is trying to find with $find.
    If i alert the categoryPanelbar var it's always null.

    Has anyone else encountered this issue and found a solution?

  2. Ivana
    Ivana avatar
    657 posts

    Posted 19 Jan 2012 Link to this post


    Try using the following approach to find the client-side object of the RadPanelBar:

    var paneljQuery = $telerik.$("[id$='_RadPanelBar1']");
    var panelBarObj = $find(paneljQuery.attr("id"));

    You could refer to this documentation section for more information of finding client objects when controls are placed in other controls.

    Kind regards,
    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
Back to Top