I have a problem when drag and drop from radgrid to radscheduler.
I am using master and content page for my process, in that content page i am having following code for drag & drop.
function rowDropping(sender, eventArgs)
{
debugger;
// Fired when the user drops a grid row
var htmlElement = eventArgs.get_destinationHtmlElement();
var scheduler = $find('ctl00_Content_RadScheduler1');
debugger;
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(
"ctl00_Content_TargetSlotHiddenField").value = timeSlot.get_index();
// The HTML needs to be set in order for the postback to execute normally
eventArgs.set_destinationHtmlElement(
"ctl00_Content_TargetSlotHiddenField");
debugger;
}
else
{
// The node was dropped elsewhere on the document
eventArgs.set_cancel(
true);
}
}
it showing the error on the this line 'var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);'.
Please find scrren shot for that error message.
How to overcome this.
Thanks in Advance ; ).
Regards
Maha
5 Answers, 1 is accepted
Please, try using scheduler.get_activeModel() instead of scheduler._activeModel and let us know if this helps.
Greetings,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thanks for your suggestion, but doesn't work.
Please find the screenshot attached and code mentioned below.
function
rowDropping(sender, eventArgs)
{
debugger;
// Fired when the user drops a grid row
var htmlElement = eventArgs.get_destinationHtmlElement();
var scheduler = $find('ctl00_Content_RadScheduler1');
debugger;
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.get_activeModel.getTimeSlotFromDomElement(htmlElement);
$get(
"ctl00_Content_TargetSlotHiddenField").value = timeSlot.get_index();
// The HTML needs to be set in order for the postback to execute normally
eventArgs.set_destinationHtmlElement(
"ctl00_Content_TargetSlotHiddenField");
debugger;
}
else
{
// The node was dropped elsewhere on the document
eventArgs.set_cancel(
true);
}
}
how to resolve it. Thanks in advance.
Regards
Utchimahali.N
We are not sure why you keep getting this error. It would be best if you can isolate the problem in a simple working demo and send it to us for further testing via a support ticket.
Regards,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Page.ClientScript.RegisterClientScriptBlock(typeof(MyProjectType), "script", AddProjectScripts()); |
private string AddProjectScripts() |
{ |
StringBuilder sb = new StringBuilder(); |
sb.Append("<script type='text/javascript'>\r\n"); |
sb.Append("function rowDropping(sender, eventArgs)\r\n{\r\n"); |
sb.Append("var htmlElement = eventArgs.get_destinationHtmlElement();\r\n"); |
sb.Append("var scheduler = $find('" + myScheduler.ClientID + "');\r\n"); |
sb.Append("if (isPartOfSchedulerAppointmentArea(htmlElement))\r\n{\r\n"); |
sb.Append("var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);\r\n"); |
sb.Append("$get('" + hid.ClientID + "').value = timeSlot.get_index();\r\n"); |
sb.Append("eventArgs.set_destinationHtmlElement('" + hid.ClientID + "');\r\n}\r\nelse\r\n{\r\n"); |
sb.Append("eventArgs.set_cancel(true);\r\n}\r\n}\r\n"); |
sb.Append("function isPartOfSchedulerAppointmentArea(htmlElement)\r\n{\r\n"); |
sb.Append("return $telerik.$(htmlElement).parents().is('div.rsAllDay') || \r\n"); |
sb.Append("$telerik.$(htmlElement).parents().is('div.rsContent')\r\n}\r\n"); |
sb.Append("function onRowDoubleClick(sender, args)\r\n{\r\n"); |
sb.Append("sender.get_masterTableView().editItem(args.get_itemIndexHierarchical());\r\n}\r\n"); |
sb.Append("</script>"); |
return sb.ToString(); |
} |
Hi,
Thanks you so much, its working.
Have a sweet, nice, happy, smiley, joyful, colorful day always.
With Smile,
Utchimahali ;)