Scheduler/Grid drag and drop issue

2 posts, 0 answers
  1. Karl
    Karl avatar
    172 posts
    Member since:
    Jun 2009

    Posted 27 Jan 2012 Link to this post

    I am using a RadGrid to drag and drop onto a RadScheduler. The page works and functions exactly as required in a standard page, however, when I place exactly the same code into a page that calls a masterpage I get a javascript error "'null' is null or not an object"

    I'm assuming this would be something to do with the following javascript, however I cant pinpoint exactly what.

    <script type="text/javascript">
                function rowDropping(sender, eventArgs) {
                    // Fired when the user drops a grid row
                    var htmlElement = eventArgs.get_destinationHtmlElement();
                    var scheduler = $find('<%= RadScheduler1.ClientID %>');
                    if (isPartOfSchedulerAppointmentArea(htmlElement)) {
                        // The row was dropped over the scheduler appointment area
                        // Find the exact time slot and save its unique index in the hidden field
                        var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);
                        $get("TargetSlotHiddenField").value = timeSlot.get_index();
                        // The HTML needs to be set in order for the postback to execute normally
                    else {
                        // The node was dropped elsewhere on the document
                function isPartOfSchedulerAppointmentArea(htmlElement) {
                    return $telerik.$(htmlElement).parents().is("div.rsAllDay") ||
                function onRowDoubleClick(sender, args) {

    Any pointers on why this wouldnt work on a page that calls a masterpage would be much appreciated - I tested this with a masterpage that was essentially blank as well with no other scripts included on it.

    Many thanks.
  2. Plamen
    Plamen avatar
    3079 posts

    Posted 31 Jan 2012 Link to this post

    Hello Karl,

    Thank you for contacting Telerik support.

    It seems that the id of the hidden field is dynamically changed when it is put in a ContentPlaceHolder. You can use jQuery as in the following code to get it:

    var TargetSlotHiddenFieldObject = $telerik.$("[id$='TargetSlotHiddenField']");
                      $get(TargetSlotHiddenFieldObject.attr('id')).value = timeSlot.get_index();

    Here I am attaching a sample demo as well.

    Hope this will be helpful.

    Plamen Zdravkov
    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