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

Is it possible to easily bind the grid to an hierarchical object Graph

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 01 Mar 2011, 03:17 PM
Let's say I have the following classes:

Public Class AddressBook
      Public Property OwnerName As String
    Public Property Friends As IList(Of Contact)
    Public Property Family As IList(Of Contact)
    Public Property Colleagues As IList(Of Contact)
 
End Class
 
Public Class Contact
    Public Property Address As Address
    Public Property Name As String
    Public Property Phone As String
    Public Property DateOfBirth As Date
    Public ReadOnly Property Age As Integer
        Get
            Return Math.Floor((Date.Now - DateOfBirth).Days / 365)
        End Get
    End Property
End Class
 
Public Class Address
    Public Property StreetNumber As Integer
    Public Property StreetName As String
    Public Property ZipCode As String
End Class

Is it possible to Databind the grid to the AdressBook and have the detail tables assigned automatically to properties like Friends, Family and Colleagues ? And then Adress to contact ?

Is it doable declaratively from the aspx file ?

2 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 07 Mar 2011, 12:30 PM
Hi Martin,

It is possible to do it with a bit of code. Please check this blog post: http://blogs.telerik.com/VladimirEnchev/Posts/08-08-11/How_To_RadGrid_hierarchy_from_objects_hierarchy.aspx

Regards,
Vasil
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Martin
Top achievements
Rank 1
answered on 07 Mar 2011, 03:42 PM
Thanks, It worked great !!!
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Martin
Top achievements
Rank 1
Share this question
or