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

ConvertToDataSource and ConvertToScheduler

2 Answers 137 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 1
Alexandre asked on 27 Apr 2009, 07:50 PM
I am trying to implement my own DataSource to the Win scheduler.
I have read the "Using a Data Provider" topic in the documentation, where the steps into making this happen are explained.

However, there is one part that is missing (or that I am missing) in the code listed there.

What should the code in ConvertIdToDataSource and ConvertIdToScheduler method should contain?
All we see is the following line and the documentation is not providing much information regarding those two properties except that it should "convert given value object to scheduler object".

idMapping.ConvertToDataSource = new ConvertCallback(this.ConvertIdToDataSource);
idMapping.ConvertToScheduler =
 new ConvertCallback(this.ConvertIdToScheduler);

ConvertIdToDataSource and ConvertIdToScheduler methods are not described in the documentation.
At least, providing the signatures for the required callbacks would be useful...

2 Answers, 1 is accepted

Sort by
0
Accepted
Neill Murphy
Top achievements
Rank 1
answered on 28 Apr 2009, 08:52 AM
cant remember how or where i got them from.....but here they are

        private object ConvertIdToScheduler(object id)  
        {  
            return new EventId(id);  
        }  
 
        private object ConvertIdToDataSource(object id)  
        {  
            return (id != null) ? (id as EventId).KeyValue : Guid.NewGuid();  
        } 
0
Jordan
Telerik team
answered on 29 Apr 2009, 07:28 AM
Hi Neill Murphy,

I just checked and indeed there is some code missing in the documentation. We will correct that.

Neill was kind enough to post the missing code (thank you Neill). This code is from the Binding example from the Q3 2008 release.

These callbacks are called (if specified) each time before a value is set to a scheduler object (usually of type Appointment) or to a data source object (usually some kind of business object that stores appointment data). They allow you to change the value if needed.

In Q1 2009 release this code became part of the AppointmentMappingInfo so that you do not need to type it every time you bind RadScheduler. Of course if the default implementation is not suitable for your case you can always change it. (This is a topic for another help article / blog post)

Sincerely yours,
Jordan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler and Reminder
Asked by
Alexandre
Top achievements
Rank 1
Answers by
Neill Murphy
Top achievements
Rank 1
Jordan
Telerik team
Share this question
or