I'm not sure if anyone else has had trouble with this. I'm trying to use a RAD Grid to create a 4-level hierarchy to display to the user. I followed the tutorial on this website, and couldn't get it to work. I know that there is data within the child select statements, but the second layer is always coming up empty. I've checked my select statements against the database, and they're all correct. I believe that the problem is where I'm populating my parameters for my datasources. I've tried using the session method used in the tutorial, but that didn't work. I saw another way of doing it by using just regular asp:Parameters, but that doesn't work either. I think that the issue is with my parameter names because the tutorial puts a large emphasis on making sure they're named properly, but I don't see where it's incorrect. Has anyone else had this issue before using a rad grid?
Here is my code.
<telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" ShowStatusBar="true" DataSourceID="depositSource"
runat="server" AutoGenerateColumns="False" PageSize="7" AllowSorting="True" AllowMultiRowSelection="False"
AllowPaging="True" GridLines="None">
<PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
<MasterTableView DataSourceID="depositSource" DataKeyNames="ID,Location" AllowMultiColumnSorting="True">
<DetailTables>
<telerik:GridTableView DataKeyNames="ID,Loc" DataSourceID="batchSource" Width="100%"
runat="server">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="deposit_ID" MasterKeyField="ID" />
<telerik:GridRelationFields DetailKeyField="loc" MasterKeyField="location" />
</ParentTableRelation>
<DetailTables>
<telerik:GridTableView DataKeyNames="ID,loc" DataSourceID="checkDFSource" Width="100%"
runat="server">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="batch_ID" MasterKeyField="ID" />
<telerik:GridRelationFields DetailKeyField="loc" MasterKeyField="loc" />
</ParentTableRelation>
<DetailTables>
<telerik:GridTableView DataKeyNames="ID,loc" DataSourceID="checkHistSource" Width="100%"
runat="server">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="check_ID" MasterKeyField="ID" />
<telerik:GridRelationFields DetailKeyField="loc" MasterKeyField="loc" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn SortExpression="routing_num" HeaderText="Routing Number" HeaderButtonType="TextButton"
DataField="routing_num" UniqueName="histRouting">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="account_num" HeaderText="Account Number" HeaderButtonType="TextButton"
DataField="account_num" UniqueName="histAccount">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="check_amt" HeaderText="Amount" HeaderButtonType="TextButton"
DataField="check_amt" UniqueName="histAmount">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="status" HeaderText="Status" HeaderButtonType="TextButton"
DataField="status" UniqueName="histStatus">
</telerik:GridBoundColumn>
</Columns>
<SortExpressions>
<telerik:GridSortExpression FieldName="check_amt" SortOrder="Descending"></telerik:GridSortExpression>
</SortExpressions>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn SortExpression="routing_num" HeaderText="Routing Number" HeaderButtonType="TextButton"
DataField="routing_num" UniqueName="dfRouting">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="account_num" HeaderText="Account Number" HeaderButtonType="TextButton"
DataField="account_num" UniqueName="dfAccount">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="check_amt" HeaderText="Amount" HeaderButtonType="TextButton"
DataField="check_amt" UniqueName="dfAmount">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="status" HeaderText="Status" HeaderButtonType="TextButton"
DataField="status" UniqueName="dfStatus">
</telerik:GridBoundColumn>
</Columns>
<SortExpressions>
<telerik:GridSortExpression FieldName="check_amt" SortOrder="Descending"></telerik:GridSortExpression>
</SortExpressions>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn SortExpression="ID" HeaderText="Batch ID" HeaderButtonType="TextButton"
DataField="ID" UniqueName="batchID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="Scanned_subtotal" HeaderText="Batch Subtotal" HeaderButtonType="TextButton"
DataField="scanned_subtotal" UniqueName="batchSubtotal" DataFormatString="{0:C}">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="num_checks_scanned" HeaderText="Batch Count" HeaderButtonType="TextButton"
DataField="num_checks_scanned" UniqueName="batchCount">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="date_add" HeaderText="Date" HeaderButtonType="TextButton"
DataField="date_add" UniqueName="batchDate" DataFormatString="{0:D}">
</telerik:GridBoundColumn>
</Columns>
<SortExpressions>
<telerik:GridSortExpression FieldName="ID"></telerik:GridSortExpression>
</SortExpressions>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn SortExpression="ID" HeaderText="Deposit ID" HeaderButtonType="TextButton"
DataField="ID" UniqueName="depositID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="location" HeaderText="Deposit Location" HeaderButtonType="TextButton"
DataField="location" UniqueName="depositLocation">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="amount" HeaderText="Amount" HeaderButtonType="TextButton"
DataField="amount" UniqueName="depositAmount" DataFormatString="{0:C}">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="count" HeaderText="Count" HeaderButtonType="TextButton"
DataField="count" UniqueName="depositCount">
</telerik:GridBoundColumn>
</Columns>
<SortExpressions>
<telerik:GridSortExpression FieldName="ID"></telerik:GridSortExpression>
</SortExpressions>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="depositSource" ConnectionString="<%$ ConnectionStrings:MAINConnectionString %>"
SelectCommand="Select * from closing_balance..cb_deposits where type = 111"
runat="server"></asp:SqlDataSource>
<asp:SqlDataSource ID="batchSource" ConnectionString="<%$ ConnectionStrings:MAINConnectionString %>"
SelectCommand="Select * from closing_balance..cb_checkBatchhf where deposit_id = @deposit_ID and loc = @Loc"
runat="server">
<SelectParameters>
<asp:Parameter Name="deposit_ID" Type="Int32"/>
<asp:Parameter Name="loc" Type="Int32"/>
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="checkDFSource" ConnectionString="<%$ ConnectionStrings:MAINConnectionString %>"
SelectCommand="Select * from closing_balance..cb_checkdf where batch_id = @batch_ID and loc = @loc"
runat="server">
<SelectParameters>
<asp:Parameter Name="batch_ID" Type="Int32"/>
<asp:Parameter Name="loc" Type="Int32"/>
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="checkHistSource" ConnectionString="<%$ ConnectionStrings:MAINConnectionString %>"
SelectCommand="Select * from closing_balance..cb_checkdfhist where check_id = @check_ID and loc = @loc"
runat="server">
<SelectParameters>
<asp:Parameter Name="check_ID" Type="Int32"/>
<asp:Parameter Name="loc" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
Thanks for your help.
EDIT
DataKeyNames
for the GridTableView
and their relational MasterKeyField
in the GridRelationField
are case sensitive...this caused the issue.