7 Answers, 1 is accepted
Indeed, you can only access appointments that are rendered (fall in the visible range). Then you could use-
scheduler.get_appointments().findByID(56).get_subject()
Greetings, Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
I have followed the instruction to create dbschedulerprovider and webservice. I 'm trying to consume webservice with following code:
$.ajax({
type:
"POST"
,
url:
"GuaranteeModule/GuaranteeSchedulerWebService.asmx/GetAppointments"
,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
,
data:
"{'schedulerInfo':{}}"
,
success:
function
(msg) {
AjaxSucceeded(msg);
},
error: AjaxFailed
});
While debugging on server side everything seems to be fine, unfortunately on client side I receive following error:
--
The added or subtracted value results in an un-representable DateTime.\r\nParameter name: t","StackTrace":" at System.DateTime.op_Subtraction(DateTime d, TimeSpan t)\r\n at Telerik.Web.UI.Scheduling.AppointmentController.ExpandRecurrence(Appointment parent, DateTime rangeStart, DateTime rangeEnd)\r\n at Telerik.Web.UI.Scheduling.AppointmentController.AddAppointmentAndExpand(Appointment appointment, DateTime rangeStart, DateTime rangeEnd)\r\n at Telerik.Web.UI.WebServiceAppointmentController.PopulateAppointments(ISchedulerInfo schedulerInfo)\r\n at Telerik.Web.UI.WebServiceAppointmentController.\u003cGetAppointments\u003ed__0`1.MoveNext()\r\n at System.Web.Script.Serialization.JavaScriptSerializer.SerializeEnumerable(IEnumerable enumerable, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentOutOfRangeException
--
I haven't tested this way of binding RadScheduler to a web service to be honest. I wonder if there is a reason why you cannot use the approach from the online demo and set:
<WebServiceSettings Path="SchedulerWebService.asmx" ResourcePopulationMode="ServerSide" />
Attached is also a working demo for reference.
You are welcome to open a support ticket and send us a sample of your implementation so we can test it locally.
Kind regards, Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
On my page I have radgrid that displays all appointments and radscheduler with defaultview=timeline to present current week appointments and deal with reminders. I use radscheduler's advanced template to edit appointments.
I want be able to edit appointment when double clicked on grids row:
function
onGridRowDblClick(sender, eventArgs)
{
var
scheduler = $find(
'<%= RadScheduler.ClientID %>'
);
var
warrantyId = eventArgs.getDataKeyValue(
"WarrantyId"
);
var
appointments = scheduler.get_appointments();
var
appointment = appointments.findByID(warrantyId);
if
(appointment != undefined)
{
scheduler.editAppointment(appointment,
true
);
}
else
{
createNewAppointment();
}
}
My problem is that get_appointments() returns only appointments that are in current scheduler view. When I double click on appointment that is not shown on in scheduler appointments.findByID(warrantyId) returns null.
Yes, this is indeed how th findById method works. As a workaround, I suggest you navigate to the date of the appointment with scheduler.set_selectedDate and handle RadScheduler's OnClientDataBound to find the appointment by id. Here is a sample code:
function
onGridRowDblClick() {
var
scheduler = $find(
'<%= RadScheduler1.ClientID %>'
);
//Here you should be able to pull the values of
//the Start time and ID of the appointment from the grid event
appId =
"9"
;
scheduler.set_selectedDate(
new
Date());
}
function
OnClientDataBound(sender, args) {
if
(appId !=
null
) {
var
scheduler = sender;
var
appointments = scheduler.get_appointments();
var
appointment = appointments.findByID(appId);
if
(appointment !=
null
) {
scheduler.editAppointment(appointment,
true
);
}
appId =
null
;
}
}
* * *
<telerik:RadScheduler ID=
"RadScheduler1"
runat=
"server"
OnClientDataBound=
"OnClientDataBound"
.../>
Best wishes,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
After scheduler.set_selectedDate(new Date(stringStartDateFromGrid)) nothing happens.
No matter if I put new Date() or new Date(stringStartDateFromGrid) OnClientDataBound never occurs
I wasn't able to replicate the problem with the file you sent. We can probably be able to pinpoint the issue if you send us a working sample which we can run without modifications.
All the best, Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.