Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm facing one problem that is related to telerik RadScheduler,when I try to move appointment from one resource to another then radscheduler event called OnClientAppointmentMoveEnd javascript function twice.

I am not sure, Is there any internal thread is calling during move appointment?
Please help in this.

Any suggestions?

What I have tried:

I have removed all server side event and make ajax call for move appointment to another resource.

JavaScript
//Javascript function call on Rad scheduler event 
function OnClientAppointmentMoveEnd1(sender, args) {                
                var scheduler = null;               
                // Cache the Scheduler object reference so we don't have to retrieve it every time
                scheduler = sender;
                try {
                    hideActiveToolTip();
                    if ($("#<%=hdnEditeTicket.ClientID%>").val() == 'N') {
                        noty({ text: 'You do not have permission!', type: 'warning', layout: 'topCenter', closeOnSelfClick: true, timeout: 1000, theme: 'noty_theme_default', closable: false, dismissQueue: true });
                        args.set_cancel(true);
                    }
                    else {
                        var appt = args.get_appointment();
                        var list = appt.get_attributes();
                        var attrAssigned = list.getAttribute('assigned');
                        var _NewStartDate = args.get_newStartTime();
                        var todaysDate = getFormattedString(_NewStartDate);
                        var NewTimeSlotIndex = args.get_targetSlot().get_index();
                        var TicketId = appt._id;
                        var resource = args.get_targetSlot().get_resource(); 
                        var workername = resource.get_text();

                        if (appt != null && list != null && attrAssigned != null && NewTimeSlotIndex != null) {
                            if (attrAssigned == "4") {
                                noty({ text: 'It is not allowed to move the completed ticket.', type: 'warning', layout: 'topCenter', closeOnSelfClick: true, timeout: 500, theme: 'noty_theme_default', closable: false, dismissQueue: true });
                                args.set_cancel(true);
                            }
                            else if (attrAssigned != "4") {  
								//This Popop is called Twice
                                if (confirm('Do you really want to move ' + appt._subject + ' ?')) {
                                    //call Ajax request
                                    $.ajax({
                                        type: "POST",
                                        contentType: "application/json; charset=utf-8",
                                        url: "ScheduleBoard.asmx/AppointmentMove",
                                        data: '{ "TicketId" : "' + TicketId + '", "TimeSlotIndex": "' + NewTimeSlotIndex + '", "StartTime": "' + todaysDate + '", "workername" : "' + workername + '" }',
                                        dataType: "json",
                                        async: false,
                                        success: function (data) {                                            
                                            console.log(data.d);                                                                                                                                   
                                        },
                                        error: function (result) {
                                            alert(result.responseText);
                                        },
                                        failure: function (result) {
                                            alert(result.responseText);
                                        }
                                    });                                   
                                    args.set_cancel(true);                                   
                                }                                 
                                else {
                                    args.set_cancel(true);
                                }
                            }
                        } else { args.set_cancel(true); }


HTML
//RadScheduler Event
<telerik:radscheduler id="RadScheduler1" runat="server" skin="Material" cssclass="RadScheduler1" rendermode="Lightweight" 
showheader="true" 
showfooter="false" 
width="99%" height="630px" shownavigationpane="true" 
customattributenames="id" 
displaydeleteconfirmation="false" 
allowdelete="false" 
starteditinginadvancedform="false" 
startinsertinginadvancedform="false" 
showalldayrow="true" 
enableexacttimerendering="true" 
onclientappointmentcontextmenu="OnClientAppointmentContextMenu" 
onclientappointmentmoveend="OnClientAppointmentMoveEnd1" 
<="" telerik:radscheduler="">
Posted
Updated 21-Jul-20 0:55am
v2
Comments
Sandeep Mewara 21-Jul-20 3:22am    
It's difficult to comment without seeing your client side code. It seems event is hooked twice.
vish_pro 21-Jul-20 3:27am    
Hi,
Please check Below code...

//Javascript function call on Rad scheduler event
function OnClientAppointmentMoveEnd1(sender, args) {
var scheduler = null;
// Cache the Scheduler object reference so we don't have to retrieve it every time
scheduler = sender;
try {
hideActiveToolTip();
if ($("#<%=hdnEditeTicket.ClientID%>").val() == 'N') {
noty({ text: 'You do not have permission!', type: 'warning', layout: 'topCenter', closeOnSelfClick: true, timeout: 1000, theme: 'noty_theme_default', closable: false, dismissQueue: true });
args.set_cancel(true);
}
else {
var appt = args.get_appointment();
var list = appt.get_attributes();
var attrAssigned = list.getAttribute('assigned');
var _NewStartDate = args.get_newStartTime();
var todaysDate = getFormattedString(_NewStartDate);
var NewTimeSlotIndex = args.get_targetSlot().get_index();
var TicketId = appt._id;
var resource = args.get_targetSlot().get_resource();
var workername = resource.get_text();

if (appt != null && list != null && attrAssigned != null && NewTimeSlotIndex != null) {
if (attrAssigned == "4") {
noty({ text: 'It is not allowed to move the completed ticket.', type: 'warning', layout: 'topCenter', closeOnSelfClick: true, timeout: 500, theme: 'noty_theme_default', closable: false, dismissQueue: true });
args.set_cancel(true);
}
else if (attrAssigned != "4") {
//This Popop is called Twice
if (confirm('Do you really want to move ' + appt._subject + ' ?')) {
//call Ajax request
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "ScheduleBoard.asmx/AppointmentMove",
data: '{ "TicketId" : "' + TicketId + '", "TimeSlotIndex": "' + NewTimeSlotIndex + '", "StartTime": "' + todaysDate + '", "workername" : "' + workername + '" }',
dataType: "json",
async: false,
success: function (data) {
console.log(data.d);
},
error: function (result) {
alert(result.responseText);
},
failure: function (result) {
alert(result.responseText);
}
});
args.set_cancel(true);
}
else {
args.set_cancel(true);
}
}
} else { args.set_cancel(true); }
vish_pro 21-Jul-20 3:28am    
Here is RadScheduler code

//RadScheduler Event
<telerik:radscheduler id="RadScheduler1" runat="server" skin="Material" cssclass="RadScheduler1" rendermode="Lightweight"
showheader="true"
showfooter="false"
width="99%" height="630px" shownavigationpane="true"
customattributenames="id"
displaydeleteconfirmation="false"
allowdelete="false"
starteditinginadvancedform="false"
startinsertinginadvancedform="false"
showalldayrow="true"
enableexacttimerendering="true"
onclientappointmentcontextmenu="OnClientAppointmentContextMenu"
onclientappointmentmoveend="OnClientAppointmentMoveEnd1"
<="" telerik:radscheduler="">
BillWoodruff 25-Jul-20 21:16pm    
Telerik has excellent support for those who purchase its expensive controls.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900