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

RadGrid issue with mixed hierarchy load

2 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karthik
Top achievements
Rank 1
Karthik asked on 01 May 2012, 12:26 PM
Hi,

I have implemented RadGrid with mixed hierarchy load. I have a trouble where sometimes the grid does not bind few records. For eg: When I have 2 levels of hierarchy and I have MasterTableView Hierarchy load mode as Client and for the other levels ServerOnDemand.
The records for master table view are not bound. I have also set the AllowExpandCollapse property for Grid.
Any idea why and when it will fail?

Thanks,
Karthik
 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 May 2012, 10:28 AM
Hello Karthik,

I was not able to reproduce the issue at my end. Here is the sample code that I tried with different HierarchyLoadModes.
aspx:
<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateEditColumn="true" AutoGenerateColumns="true"DataSourceID="SqlDataSource1" OnItemDataBound="RadGrid1_ItemDataBound">
    <MasterTableView DataKeyNames="CustomerID" CommandItemDisplay="Top" HierarchyLoadMode="Client">
      <DetailTables>
            <telerik:GridTableView HierarchyLoadMode="ServerOnDemand" AutoGenerateColumns="true" DataKeyNames="OrderID" DataSourceID="SqlDataSource2" ExpandCollapseColumn-Display="true">
               <ParentTableRelation>
                  <telerik:GridRelationFields  DetailKeyField="CustomerID" MasterKeyField="CustomerID" />
               </ParentTableRelation>
     <DetailTables>
    <telerik:GridTableView  HierarchyLoadMode="ServerOnDemand"  DataKeyNames="OrderID" DataSourceID="SqlDataSource3" AutoGenerateColumns="true">
       <ParentTableRelation>
        <telerik:GridRelationFields DetailKeyField="OrderID" MasterKeyField="OrderID" />
       </ParentTableRelation>
    </telerik:GridTableView>
   </DetailTables>
  </telerik:GridTableView>
 </DetailTables>
</MasterTableView>
</telerik:RadGrid>
Please elaborate your scenario if it doesn't helps.

Thanks,
Shinu.
0
Karthik
Top achievements
Rank 1
answered on 02 May 2012, 11:38 AM
Hello Shinu,

Thanks for the reply. I was trying to debug the problem and found that in one of the Detail Tables there was a problem binding the DataKeyNames (Error: Could not bind DataKeyNames as it doesn't exist in Table1). This happened when the result set was empty. When I changed the DataKeyNames binding from static to dynamic (added from DetailTableDataBind Event) It worked. Please find the code below which shows the case where i encountered the problem. Would be better if you could provide the best way to use hierarchical radgrid.
Note: The Hierarchy Load Mode is set dynamically based on few conditions.

<MasterTableView Name="Master" ItemStyle-BackColor="#ffffef" AlternatingItemStyle-BackColor="#ffffef"
    TableLayout="Fixed" HorizontalAlign="Center" GroupLoadMode="Client" AutoGenerateColumns="false"                    
          DataKeyNames="ItemId">
      <DetailTables>
             <telerik:GridTableView Name="Child1" DataKeyNames="Project_Id" TableLayout="Fixed"
                 ItemStyle-BackColor="#ffffff" HorizontalAlign="Center"
                                               AlternatingItemStyle-BackColor="#ffffff"
          
    
AutoGenerateColumns="false">
             </telerik:GridTableView>
       </DetailTables>
</MasterTableView>
 
Thanks,
Karthik
Tags
Grid
Asked by
Karthik
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Karthik
Top achievements
Rank 1
Share this question
or