Passing attributes (filter) to the SchedulerProvider

6 posts, 0 answers
  1. Roel Abspoel
    Roel Abspoel avatar
    8 posts
    Member since:
    Nov 2008

    Posted 07 Apr 2010 Link to this post

    Hi,

    I would like to use the RadScheduler with an ASMX webservice for fetching appointment data. This works, but i would like to send some attributes along with the request so the SchedulerProvider can use this as a filter. Otherwise i have to get fetch a lot of data from my data layer.

    I have tried to use the SchedulerProvider directly setting the property ProviderName on the RadScheduler and removed the webservice settings. When i add an attribute to the RadScheduler object, it is accessible in the SchedulerProvider. This way of passing filter values works, but not when is use the webservice.

    Is it possible to send custom attributes along with the webservice call?
  2. Roel Abspoel
    Roel Abspoel avatar
    8 posts
    Member since:
    Nov 2008

    Posted 08 Apr 2010 Link to this post

    Okay,

    i have solved this problem. Created an derived class from the SchedulerInfo class and used this new class as funtion parameter in the GetAppointments function. (see code below). During the OnClientAppointmentsPopulating event, i add the extra property value VestigingID in the OnClientAppointmentsPopulating event (see second code block). This works!

    My second problem is to pass the property value from SchedulerInfo2 class to the Controller or SchedulerProvider. 
    Who has an idea to solve this problem?
      

    Code in the ASMX Webservice:  
    public class SchedulerInfo2 : SchedulerInfo  
    {  
        private int _vestigingid;  
     
        public int VestigingID  
        {  
            get { return _vestigingid; }  
            set { _vestigingid = value; }  
        }  
    }   
     
    [WebMethod(EnableSession = true)]  
    public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo2 schedulerInfo)  
    {  
        IEnumerable<AppointmentData> data = Controller.GetAppointment(schedulerInfo);  
        return data;  

    javascript code on the RadScheduler page:

    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">  
        <script type="text/javascript">  
     
            function Scheduler_OnClientAppointmentsPopulating(sender, eventArgs) {  
     
                var schedulerinfo = eventArgs.get_schedulerInfo();  
                schedulerinfo.vestigingid = 4;  
            }  
              
        </script>     
        </telerik:RadScriptBlock> 

     

     

     

  3. Pedro Cordero
    Pedro Cordero avatar
    5 posts
    Member since:
    Jun 2008

    Posted 08 Apr 2010 Link to this post

    not sure if this is the optimal method but I simply store my filter parameters in a Session object (I use this with client side binding+server side resource population to filter the scheduler) that's accessible by both the web service and the controller.
  4. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 09 Apr 2010 Link to this post

    Hi Pedro,

    I can confirm that your approach is correct - you need to inherit IScheduler info like you did. We will take care to create a help topic in the documentation for this scenario.

    The session is the best option for passing that info to the provider. We will be revising the provider interface to make this easier in the future. You can also instantiate the provider in the web service and set properties directly.

    Sincerely yours,
    Tsvetomir Tsonev
    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.
  5. Marc-Antoine
    Marc-Antoine avatar
    6 posts
    Member since:
    Apr 2012

    Posted 03 May 2012 Link to this post

    Hello,

    I'm developping a custom SchedulerInfo. I've made exactly as Roel made but my attribute is an Int List.
    On compiling, ASP.NET Tells me that my SchedulerInfo is not Serializable.

    Could you help me please ..?

    public class ApplicationSchedulerInfo : SchedulerInfo
        {
            private IEnumerable<int> _type_ressources_view_list;
            public ApplicationSchedulerInfo (ISchedulerInfo inf) : base(inf) {
                _type_ressources_view_list = new List<int>();
            }
           
            public IEnumerable<int> TypeResourceList
            {
                get
                {
                    if (_type_ressources_view_list == null)
                        _type_ressources_view_list = new List<int>();
                    return _type_ressources_view_list;
                }
                set
                {
                    _type_ressources_view_list = value;
                }
            }
        }


    and in Default.aspx.cs :
    protected void OnResourcesPopulating(object sender, ResourcesPopulatingEventArgs e)
            {
                ApplicationSchedulerInfo info = new ApplicationSchedulerInfo(e.SchedulerInfo);
                foreach (ListItem item in this.CheckBoxListControls.Items) {
                    if (item.Selected)
                        ((List<int>) info.TypeResourceList).Add(int.Parse(item.Value));
                }

                e.SchedulerInfo = info;
            }

    Thank you for your Help ..
  6. Plamen
    Admin
    Plamen avatar
    2959 posts

    Posted 08 May 2012 Link to this post

    Hello,

     
    I am attaching the sample project that implements similar functionality as in our First Look

    Hope this will be helpful.

    All the best,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top