get Appointment by id

8 posts, 0 answers
  1. piotre6
    piotre6 avatar
    18 posts
    Member since:
    Apr 2011

    Posted 03 Aug 2011 Link to this post

    Is it possible to get appointment (needed for editAppointment function) by id on client side?
    I have tried to use  scheduler.get_appointments(), unfortunately it only shows appointments oc current view.
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 03 Aug 2011 Link to this post

    Hi Piotre6,

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. piotre6
    piotre6 avatar
    18 posts
    Member since:
    Apr 2011

    Posted 03 Aug 2011 Link to this post

    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
    --
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 04 Aug 2011 Link to this post

    Hello Piotre6,

    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.

  6. piotre6
    piotre6 avatar
    18 posts
    Member since:
    Apr 2011

    Posted 04 Aug 2011 Link to this post

    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.
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 05 Aug 2011 Link to this post

    Hello Piotre6,

    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.

  8. piotre6
    piotre6 avatar
    18 posts
    Member since:
    Apr 2011

    Posted 10 Aug 2011 Link to this post

    I have replaced new Date() with new Date(stringStartDateFromGrid). Date seems to be ok.
    After scheduler.set_selectedDate(new Date(stringStartDateFromGrid)) nothing happens.

    No matter if I put new Date() or new Date(stringStartDateFromGrid) OnClientDataBound never occurs
  9. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 15 Aug 2011 Link to this post

    Hello Piotre6,

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017