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

Binding Hierarchy grid to object

1 Answer 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe Lozina
Top achievements
Rank 1
Joe Lozina asked on 23 Sep 2010, 10:12 AM
Hi

I am trying to bind a collection of objects to a Hierarchy grid. The Parent rows are the Comment objects and the Children are the Activity objects. The Comment object contains a list of Activity objects.

the code I'm trying to get working is

<telerik:RadGrid CssClass="telerikrid" ID="CommentsGrid1" runat="server" GridLines="None"
           Width="100%" ShowGroupPanel="False" AllowSorting="True" Skin="Windows7" OnNeedDataSource="Comments1_NeedDataSource"
           Font-Size="7">
           <MasterTableView RetrieveAllDataFields="true" AutoGenerateColumns="False">
               <DetailTables>
                   <telerik:GridTableView>
                    <ParentTableRelation>
                           <telerik:GridRelationFields DetailKeyField="JdeSite" MasterKeyField="JdeSite" />
                       </ParentTableRelation>
                       <Columns>
                              <telerik:GridBoundColumn DataField="JdeSite" HeaderText="Site" />
                           <telerik:GridBoundColumn DataField="Type" HeaderText="Type" />
                           <telerik:GridBoundColumn DataField="OwnerName" HeaderText="Owner" />
                       </Columns>
                   </telerik:GridTableView>
               </DetailTables>
               <Columns>
                   <telerik:GridBoundColumn DataField="JdeSite" HeaderText="Site" />
                   <telerik:GridBoundColumn DataField="JdeCode" HeaderText="JDE Site" />
                   <telerik:GridBoundColumn DataField="TradingName" HeaderText="Trading Name" />
                   <telerik:GridBoundColumn DataField="BookingStartDate" HeaderText="Booking Start Date" />
                   <telerik:GridBoundColumn DataField="BookingEndDate" HeaderText="Booking End Date" />
                   <telerik:GridBoundColumn DataField="Comments" HeaderText="Comments" />
               </Columns>
           </MasterTableView>
       </telerik:RadGrid>



public class Comment
  {
      public string OptyRowId { get; set; }
      public int WeekNo { get; set; }
      public string JdeSite { get; set; }
      public string JdeCode { get; set; }
      public string TradingName { get; set; }
      public DateTime BookingStartDate { get; set; }
      public DateTime BookingEndDate { get; set; }
      public string Comments { get; set; }
      public List<Activity> ActivityList { get; set; }
 
  }
   
   
   public class Activity
  {
      public string JdeSite { get; set; }
      public string Type { get; set; }
      public string OwnerName { get; set; }
       
  }

Thanks,
Joe

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 28 Sep 2010, 12:59 PM
Hi Joe,

Please check out the following forum post which elaborate on the same matter:
http://www.telerik.com/community/forums/aspnet-ajax/grid/hierarchy-grid-with-list-object-defined.aspx

Greetings,
Radoslav
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
Tags
Grid
Asked by
Joe Lozina
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or