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

Passing attributes (filter) to the SchedulerProvider

5 Answers 117 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Roel Abspoel
Top achievements
Rank 1
Roel Abspoel asked on 07 Apr 2010, 02:43 PM
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?

5 Answers, 1 is accepted

Sort by
0
Roel Abspoel
Top achievements
Rank 1
answered on 08 Apr 2010, 10:04 AM
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> 

 

 

 

0
Pedro Cordero
Top achievements
Rank 1
answered on 08 Apr 2010, 02:01 PM
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.
0
T. Tsonev
Telerik team
answered on 09 Apr 2010, 10:39 AM
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.
0
Marc-Antoine
Top achievements
Rank 1
answered on 03 May 2012, 05:15 PM
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 ..
0
Plamen
Telerik team
answered on 08 May 2012, 04:51 PM
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.
Tags
Scheduler
Asked by
Roel Abspoel
Top achievements
Rank 1
Answers by
Roel Abspoel
Top achievements
Rank 1
Pedro Cordero
Top achievements
Rank 1
T. Tsonev
Telerik team
Marc-Antoine
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or