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

Javascript problems with webservice demo in dynamic usercontrol

1 Answer 30 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Roel
Top achievements
Rank 1
Roel asked on 17 Jan 2012, 11:00 AM
Hi,

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 () {
                categoryNames.push($(this).attr('name'));
            });
        }

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?


Regards,
Roel

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 19 Jan 2012, 05:08 PM
Hello,

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"));
alert(panelBarObj.get_id());

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

Kind regards,
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
Tags
Scheduler
Asked by
Roel
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or