New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Sending Additional Information to the Web Service

In our examples, the Web Service methods take SchedulerInfo as first parameter, but this can be replaced by any classimplementing ISchedulerInfo. This allows you to send additional information from the client to the web service.

Your ISchedulerInfo implementation must be deserializable by JavaScriptSerializer(ASP.NET AJAX Web Services) or DataContractSerializer(WCF Services).

  1. Create a custom ISchedulerInfo implementation by inheriting from SchedulerInfo:


    public class MySchedulerInfo : SchedulerInfo
       public string User { get; set; }
       public MySchedulerInfo(ISchedulerInfo baseInfo, string user)
           : base(baseInfo)
           User = user;
        public MySchedulerInfo() {}


    Public Class MySchedulerInfo
     Inherits SchedulerInfo
     Public Property User() As String
       Return m_User
      End Get
       m_User = Value
      End Set
     End Property
     Private m_User As String
     Public Sub New(baseInfo As ISchedulerInfo, userParam As String)
      User = userParam
     End Sub
     Public Sub New()
        End Sub
    End Class 
  2. Populate the MySchedulerInfo properties in one of the following client-side events:

    For example:


    function appointmentsPopulating(sender, eventArgs)
       eventArgs.get_schedulerInfo().User = "UserA";
  3. Change the corresponding Web Service method to take MySchedulerInfo as parameter:


    public IEnumerable<AppointmentData> GetAppointments(MySchedulerInfo schedulerInfo)
        // Access schedulerInfo.User
        return Controller.GetAppointments(schedulerInfo);


    Public Function GetAppointments(schedulerInfo As MySchedulerInfo) As IEnumerable(Of AppointmentData)
        ' Access schedulerInfo.User
        Return Controller.GetAppointments(schedulerInfo)
    End Function

Note that the schedulerInfo will be forwarded to the underlying provider. In order to access it you mustimplement the provider methods that take ISchedulerInfo as parameter. These methods were introduced in the Q3 2010release. For more information see Sending additionalinformation to the provider.

See Also

In this article