I have a simple grid that displays master records and their related child records. The following is my grid:
In the NeedDataSource event of the grid, I retrieve a Dataset from the database. The Dataset contains 2 Datatables, and once it is retrieved I set a relation on the primary column of each Datatable using a DataRelation, then set the grid's DataSource equal to the Dataset. This all works fine - my grid is shown with all the parent records displayed - and when I click to expand any parent record it sucessfully displays that rows detail records.
The problem is, the grid posts back each time a parent is expanded - which I don't want. The Dataset is small enough that I want the entire grid loaded and set up to make expanding and collapsing parent records faster and smoother with no screen refresh. I tried adding the HierarchyLoadMode="Client" to both the MasterTableView tag as well as the telerik:GridTableView tag within the DetailTables tag - no matter where I put it it doesn't work - what I get with HierarchyLoadMode="Client" is a grid that displays all my parent records, and when I expand any parent record I see an empty detail grid stating "No records to display"
After reading up on the HierarchyLoadMode="Client" option I thought it would force the grid to load all parent and child records up front so there would be no need to post back on expanding parent records but I must be missing something - what else do I need to set up to allow this to work?
TIA
<telerik:RadGrid runat="server" ID="rgGrid1" AutoGenerateHierarchy="true" Skin="RAPIDSKIN" EnableEmbeddedSkins="false" data-role="none" AutoGenerateColumns="false"> <ClientSettings AllowExpandCollapse="true"> <ClientEvents OnRowClick="RowClick" /> </ClientSettings> <MasterTableView Name="Master"> <DetailTables> <telerik:GridTableView> <Columns> <telerik:GridBoundColumn DataField="RISK_STATE" HeaderText="EXPOSURE" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="PREMIUM" HeaderText="PREMIUM" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Right" DataType="System.Decimal" DataFormatString="{0:c}" ItemStyle-HorizontalAlign="Right"></telerik:GridBoundColumn> </Columns> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridBoundColumn ItemStyle-HorizontalAlign="Left" DataField="HOME_STATE" HeaderText="HOME STATE" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Left"></telerik:GridBoundColumn> <telerik:GridBoundColumn ItemStyle-HorizontalAlign="Right" DataField="PREMIUM" HeaderText="PREMIUM" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Right" DataType="System.Decimal" DataFormatString="{0:c}"></telerik:GridBoundColumn> </Columns> </MasterTableView></telerik:RadGrid>In the NeedDataSource event of the grid, I retrieve a Dataset from the database. The Dataset contains 2 Datatables, and once it is retrieved I set a relation on the primary column of each Datatable using a DataRelation, then set the grid's DataSource equal to the Dataset. This all works fine - my grid is shown with all the parent records displayed - and when I click to expand any parent record it sucessfully displays that rows detail records.
The problem is, the grid posts back each time a parent is expanded - which I don't want. The Dataset is small enough that I want the entire grid loaded and set up to make expanding and collapsing parent records faster and smoother with no screen refresh. I tried adding the HierarchyLoadMode="Client" to both the MasterTableView tag as well as the telerik:GridTableView tag within the DetailTables tag - no matter where I put it it doesn't work - what I get with HierarchyLoadMode="Client" is a grid that displays all my parent records, and when I expand any parent record I see an empty detail grid stating "No records to display"
After reading up on the HierarchyLoadMode="Client" option I thought it would force the grid to load all parent and child records up front so there would be no need to post back on expanding parent records but I must be missing something - what else do I need to set up to allow this to work?
TIA