Objectdatasource Appointment and CustomAttributes

3 posts, 0 answers
  1. Corey Alguire
    Corey Alguire avatar
    43 posts
    Member since:
    Sep 2004

    Posted 09 May 2008 Link to this post

    I (like several other people in this forum) am trying to customize Scheduler using an ObjectDataSource. I read in another thread that Telerik has decided not to implement a Dataitem property because CustomAttributes makes it obsolete. First of all, I find this a bit confusing, as Dataitem is pretty standard, not only across .Net controls, but also across Telerik controls. The departure from a standard that most people pretty much expect is a strange choice, IMHO. In addition, CustomAttributes actually seems to create (a bit) more coding, as developers have to add the attributes to the customattributenames list, and then access the individual attributes. With Dataitem, I just have to cast the object, and the properties are already there ready to be accessed by name. Again, a bit of a strange (and from my perspective, disappointing) choice, in my opinion.

    But to the point- The object list I am binding to has member objects whose properties I need to access on Appointment binding. For example, I have roughly the following:

    >>>First Name
    >>>Last Name

    and so on. In order to access the Name property of Business, I assumed (and tried) using Business.Name as a custom attribute name. Then on AppointmentDataBound, I tried to access the value via e.Appointment.Attributes("Business.Name"). From what I have seen in the examples, it seems this ought to work, but for some reason for me it just doesn't. I know the objects exist and have data in their properties- I just can't access them.

    I am probably missing something obvious here, but I am just not getting it. Any help is greatly appreciated.
  2. Simon
    Simon avatar
    2281 posts

    Posted 12 May 2008 Link to this post

    Hello Corey Alguire,

    Thank you for contacting us and sharing your opinion on the matters.

    Actually, we use CustomAttributeNames because there is no way of acquiring a DataItem object when working through Providers. Still, we will consider implementing this property for cases where it would be possible, i.e. binding to a standard Data Source.

    As for the next issue, RadScheduler supports only first-level binding, that is you can access only the first-level properties of the Business object you are binding to. We will also consider implementing this functionality for future versions of the control, if possible.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
  4. Corey Alguire
    Corey Alguire avatar
    43 posts
    Member since:
    Sep 2004

    Posted 14 May 2008 Link to this post

    Thanks for the response, Simon, and I appreciate the consideration. I love the control and look forward to seeing how things develop and mature.

    For the time-being, for anyone interested, I did come up with a workaround to the problem. It isn't pretty, but it works. For the object list I am binding to, I added a readonly property to the "Event" object (from my example in this thread) that returns a serialized xml string version of the member object I want to access (Person in my example). I added this property (XmlPerson) to the CustomAttributes list for RadScheduler so it would be accessible on AppointmentDataBound. Then during that event, I deserialize the XmlPerson attribute into a Person object to play with as needed.

    In my real project, there are a fair number of properties I want to access- if it were only a couple, as in my example, I probably wouldn't bother with this, as serializing and then immediately deserializing an object clearly has a small performance impact. In my case, however, the object contains a lot of properties that affect the behavior and appearance of appointments in the scheduler, so it was worth the extra effort.
Back to Top