I have a master/detail heirachary. The first expand of the master row to the respective details works fine. But then I can neither collapse that master row nor expand another row?
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if ((string)e.CommandName == "ExpandCollapse")
{
string keyValues = ((GridEditableItem)e.Item).KeyValues;
if (e.Item.OwnerTableView.Name == "MasterTable")
{
GridDataItem item = (GridDataItem)e.Item;
Session["Headerkey"] = item["Headerkey"].Text; // set the primary key of the details table before the bind of the expand
}
}
}
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" PageSize="20" ShowFooter="True" CellSpacing="-1" GridLines="Both"
CssClass="MyGridView"
OnItemCommand="RadGrid1_ItemCommand"
AllowCustomPaging="True">
<GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
<ClientSettings EnableRowHoverStyle="True" AllowDragToGroup="True">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView AutoGenerateColumns="False" ShowGroupFooter="true" CommandItemDisplay="Top" DataKeyNames="Headerkey" Name="MasterTable">
<CommandItemSettings ShowAddNewRecordButton="False" ShowExportToCsvButton="True" ShowExportToExcelButton="True" ShowPrintButton="true" />
<Columns>
<telerik:GridBoundColumn DataField="Headerkey" DataType="System.Int32" Display="true" FilterControlAltText="Filter Headerkey column" HeaderText="Headerkey" ReadOnly="True" SortExpression="Headerkey" UniqueName="Headerkey">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Groupkey" DataType="System.Int32" Display="False" FilterControlAltText="Filter Groupkey column" HeaderText="Groupkey" SortExpression="Groupkey" UniqueName="Groupkey">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="xh.DTM02_ProductionDate" FilterControlAltText="Filter xh.DTM02_ProductionDate column" HeaderText=" Production Date" ReadOnly="True" SortExpression="xh.DTM02_ProductionDate" UniqueName="xh.DTM02_ProductionDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="xh.BPR16_CheckIssueEFT_EffectiveDate" FilterControlAltText="Filter xh.BPR16_CheckIssueEFT_EffectiveDate column" HeaderText=" Check Issue Effective Date" ReadOnly="True" SortExpression="xh.BPR16_CheckIssueEFT_EffectiveDate" UniqueName="xh.BPR16_CheckIssueEFT_EffectiveDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BPR02_TotlActlProvdrPaymntAmnt" DataFormatString="{0:c}" FilterControlAltText="Filter BPR02_TotlActlProvdrPaymntAmnt column" HeaderText="Payment Amnt" SortExpression="BPR02_TotlActlProvdrPaymntAmnt" UniqueName="BPR02_TotlActlProvdrPaymntAmnt" Aggregate="Sum" FooterText="Total: $">
<ItemStyle HorizontalAlign="Right" />
<FooterStyle HorizontalAlign="Right" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BPR13_ReceiverorProviderBankIDNo" FilterControlAltText="Filter BPR13_ReceiverorProviderBankIDNo column" HeaderText="BPR13_ReceiverorProviderBankIDNo" SortExpression="BPR13_ReceiverorProviderBankIDNo" UniqueName="BPR13_ReceiverorProviderBankIDNo" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BPR15_ReceiverorProviderAccntNo" FilterControlAltText="Filter BPR15_ReceiverorProviderAccntNo column" HeaderText="BPR15_ReceiverorProviderAccntNo" SortExpression="BPR15_ReceiverorProviderAccntNo" UniqueName="BPR15_ReceiverorProviderAccntNo" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="TRN02_CheckEFT_TraceNumber" FilterControlAltText="Filter TRN02_CheckEFT_TraceNumber column" HeaderText="Trace Number" ReadOnly="True" SortExpression="TRN02_CheckEFT_TraceNumber" UniqueName="TRN02_CheckEFT_TraceNumber" Display="false">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView runat="server" DataKeyNames="HeaderKey" DataSourceID="SqlDataSource2" Name="DetailTable" NoDetailRecordsText="No era details to display." NoMasterRecordsText="No era to display." CommandItemDisplay="Top" CommandItemSettings-ShowAddNewRecordButton="false" AutoGenerateColumns="false" AllowNaturalSort="False">
<ColumnGroups>
<telerik:GridColumnGroup HeaderText="Patient" Name="Patient" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
</telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Service" Name="Service" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
</telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Provider" Name="Provider" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
</telerik:GridColumnGroup>
<telerik:GridColumnGroup HeaderText="Payer" Name="Payer" HeaderStyle-HorizontalAlign="Center">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
</telerik:GridColumnGroup>
</ColumnGroups>
<CommandItemSettings ShowAddNewRecordButton="False" ShowRefreshButton="False"></CommandItemSettings>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="HeaderKey" MasterKeyField="HeaderKey"></telerik:GridRelationFields>
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn DataField="PatientName" FilterControlAltText="Filter PatientName column" HeaderText="Patient Name" SortExpression="Name" UniqueName="PatientName" Display="true" ColumnGroupName="Patient">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="InsuredID" FilterControlAltText="Filter InsuredID column" HeaderText="Insured ID" SortExpression="InsuredID" UniqueName="InsuredID" Display="true" ColumnGroupName="Patient">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="GroupNumber" HeaderText="Group Number" SortExpression="GroupNumber" UniqueName="GroupNumber" Display="true" ColumnGroupName="Patient">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PatientID" FilterControlAltText="Filter PatientID column" HeaderText="PatientID" SortExpression="PatientID" UniqueName="PatientID" Display="false" ColumnGroupName="Patient">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ServiceDate" FilterControlAltText="Filter ServiceDate column" HeaderText="Service Date" SortExpression="ServiceDate" UniqueName="ServiceDate" Display="true" ColumnGroupName="Service">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ServiceAmount" FilterControlAltText="Filter ServiceAmount column" HeaderText="Service Fee " SortExpression="ServiceAmount" UniqueName="ServiceAmount" Display="true" ColumnGroupName="Service" DataFormatString="{0:c}">
<ItemStyle HorizontalAlign="Right" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CoPay/CoIns" FilterControlAltText="Filter CoPay/CoIns column" HeaderText="Patient / Responsible" SortExpression="CoPay/CoIns" UniqueName="CoPay/CoIns" Display="true" ColumnGroupName="Service" DataFormatString="{0:c}">
<ItemStyle HorizontalAlign="Right" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ClaimAmtPaid" FilterControlAltText="Filter ClaimAmtPaid column" HeaderText="Amount Paid" SortExpression="ClaimAmtPaid" UniqueName="ClaimAmtPaid" Display="true" ColumnGroupName="Service" DataFormatString="${0:#,###.##}">
<ItemStyle HorizontalAlign="Right" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PayerName" FilterControlAltText="Filter PayerName column" HeaderText="Payer Name" SortExpression="PayerName" UniqueName="PayerName" Display="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PayeeName" FilterControlAltText="Filter PayeeName column" HeaderText="Payee Name" SortExpression="PayeeName" UniqueName="PayeeName" Display="true" ColumnGroupName="Provider">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="RenderingProvider" FilterControlAltText="Filter RenderingProvider column" HeaderText="Rendering Provider" SortExpression="RenderingProvider" UniqueName="RenderingProvider" Display="true" ColumnGroupName="Provider">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="NPI" FilterControlAltText="Filter NPI column" HeaderText="NPI" SortExpression="NPI" UniqueName="NPI" Display="true" ColumnGroupName="Provider">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CLP07_PayerClaimControlNumber" HeaderText="Payer Control No" SortExpression="CLP07_PayerClaimControlNumber" UniqueName="CLP07_PayerClaimControlNumber" Display="true" ColumnGroupName="Payer">
</telerik:GridBoundColumn>
</Columns>
<PagerStyle Position="TopAndBottom" />
</telerik:GridTableView>
</DetailTables>
<PagerStyle Position="TopAndBottom" />
</MasterTableView>
<PagerStyle Mode="NextPrev" PageSizes="10;20;50" Position="TopAndBottom" />
</telerik:RadGrid>