ConvertToDataSource and ConvertToScheduler

3 posts, 1 answers
  1. Alexandre
    Alexandre avatar
    3 posts
    Member since:
    Apr 2009

    Posted 27 Apr 2009 Link to this post

    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. Answer
    Neill Murphy
    Neill Murphy avatar
    7 posts
    Member since:
    Oct 2012

    Posted 28 Apr 2009 Link to this post

    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();  
            } 
  3. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 29 Apr 2009 Link to this post

    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.
Back to Top