This is a migrated thread and some comments may be shown as answers.

Sending additional information to the scheduler

1 Answer 57 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 18 Oct 2010, 12:30 PM
My scheduler is populated via a webservice call that returns an XmlDocument. I want to send some additional data that is associated with each appointment. I have tried adding a new element and key to the resources section of the Xml but this makes the scheulder have an error (object reference not set). I've also tried adding it as an extra element which generates no errors, but I can't find a way to retrieve the information.

Can you advise how to do this?

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 21 Oct 2010, 05:31 PM
Hi Simon,

Please, refer to the attached demo.

You can use OnClientAppointmentsPopulating to pass extra info to your provider:
<script type="text/javascript">
       var selectedValue = "-";
       function OnClientSelectedIndexChanging(sender, eventArgs) {            
           selectedValue = eventArgs.get_item().get_value();           
           var scheduler = $find('<%=RadScheduler1.ClientID %>');
           scheduler.rebind();
       }
       function OnClientAppointmentsPopulating(sender, eventArgs) { 
           eventArgs.get_schedulerInfo().FilterValue = selectedValue;
           selectedValue = "-";
       }
   </script>

The FilterVAlue property is defined and used in SchedulerWebService.cs:
using System.Collections.Generic;
using System.Web.Script.Services;
using System.Web.Services;
using System.Configuration;
using System.Data.Common;
using Telerik.Web.UI;
  
  
public class MySchedulerInfo : SchedulerInfo
{
    public string FilterValue
    {
        get;
        set;
    }
}
  
[WebService]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class SchedulerWebService : WebService
{
    private WebServiceAppointmentController _controller;
    //private MySchedulerInfo localSchedulerInfo;
    private MyDbSchedulerProvider _provider;
    private MyDbSchedulerProvider Provider
    {
        get
        {
            if (_provider == null)
            {
                var connString = ConfigurationManager.ConnectionStrings["TelerikConnectionString"].ConnectionString;
                var factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
                _provider = new MyDbSchedulerProvider() { ConnectionString = connString, DbFactory = factory, PersistChanges= true };
            }
            return _provider;
        }
    }
  
    /// <summary>
    /// The WebServiceAppointmentController class is used as a facade to the SchedulerProvider.
    /// </summary>
    private WebServiceAppointmentController Controller
    {
        get
        {
            if (_controller == null)
            {
                _controller = new WebServiceAppointmentController(Provider);
            }
  
            return _controller;
        }
    }
  
    [WebMethod]
    public IEnumerable<AppointmentData> GetAppointments(MySchedulerInfo schedulerInfo)
    {
        Provider.FilterValue = schedulerInfo.FilterValue;
        return Controller.GetAppointments(schedulerInfo);
    }
  
    [WebMethod]
    public IEnumerable<AppointmentData> InsertAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)
    {
        return Controller.InsertAppointment(schedulerInfo, appointmentData);
    }
  
    [WebMethod]
    public IEnumerable<AppointmentData> UpdateAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)
    {
        return Controller.UpdateAppointment(schedulerInfo, appointmentData);
    }
  
    [WebMethod]
    public IEnumerable<AppointmentData> CreateRecurrenceException(SchedulerInfo schedulerInfo, AppointmentData recurrenceExceptionData)
    {
        return Controller.CreateRecurrenceException(schedulerInfo, recurrenceExceptionData);
    }
  
    [WebMethod]
    public IEnumerable<AppointmentData> RemoveRecurrenceExceptions(SchedulerInfo schedulerInfo, AppointmentData masterAppointmentData)
    {
        return Controller.RemoveRecurrenceExceptions(schedulerInfo, masterAppointmentData);
    }
  
    [WebMethod]
    public IEnumerable<AppointmentData> DeleteAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData, bool deleteSeries)
    {
        return Controller.DeleteAppointment(schedulerInfo, appointmentData, deleteSeries);
    }
  
    [WebMethod]
    public IEnumerable<ResourceData> GetResources(SchedulerInfo schedulerInfo)
    {
        return Controller.GetResources(schedulerInfo);
    }
}

You can also see the following related forum posts for more clarity on the matter:

http://www.telerik.com/community/forums/aspnet-ajax/scheduler/passing-attributes-filter-to-the-schedulerprovider.aspx

http://www.telerik.com/community/forums/aspnet-ajax/scheduler/sending-extra-info-to-the-web-service.aspx



Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
Simon
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or