Expand / Collapse only works on first expand

5 posts, 0 answers
  1. david
    david avatar
    210 posts
    Member since:
    May 2007

    Posted 21 Jun Link to this post

    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>

  2. david
    david avatar
    210 posts
    Member since:
    May 2007

    Posted 23 Jun in reply to david Link to this post

    Another data point, the SQL is working fine, SQL profiler shows a correct query as expands are clicked.

     

    Any ideas?

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 24 Jun Link to this post

    Hello,

    Could you open the browser console and check if any error is thrown when you expand/collapse grid rows?

    Regards,
    Pavlina
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  5. david
    david avatar
    210 posts
    Member since:
    May 2007

    Posted 27 Jun in reply to Pavlina Link to this post

    Hi Pavlina

    firstly my apologies, I pasted in the wrong source, the problem I am having is a three level master-detail-detail below (no errors in console).

     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["PractitionerIDKey"] = item["PractitionerID"].Text; // set the primary key of the details table before thebind of the expand
                }
                else if (e.Item.OwnerTableView.Name == "DetailsTable")
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    Session["SubmissionDate"] = item["SubmissionDate"].Text;

                    Session["PractitionerIDKey"] = item["PractitionerID"].Text;
                }
            }

    }

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateHierarchy="True" DataSourceID="SqlDataSource2"
        CssClass="MyGridView"
        ShowFooter="true"
        OnItemCommand="RadGrid1_ItemCommand"
        OnItemDataBound="RadGrid1_ItemDataBound"
        AutoGenerateColumns="False" PageSize="20">
        <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
        <MasterTableView DataKeyNames="PractitionerID" DataSourceID="SqlDataSource2" CommandItemDisplay="Top" Name="MasterTable">
            <CommandItemSettings ShowAddNewRecordButton="False" ShowExportToExcelButton="True" ShowExportToPdfButton="True" ShowRefreshButton="true" />
            <Columns>
                <telerik:GridBoundColumn DataField="PractitionerID" DataType="System.Int16" HeaderText="PractitionerID" SortExpression="PractitionerID" UniqueName="PractitionerID" Display="false">
                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn DataField="flname" DataType="System.String" HeaderText="Practitioner" SortExpression="flname" UniqueName="flname">
                </telerik:GridBoundColumn>
            </Columns>
            <DetailTables>
                <telerik:GridTableView runat="server" DataKeyNames="PractitionerID" DataSourceID="SqlDataSource3" Name="DetailsTable" NoDetailRecordsText="No submissions to display." NoMasterRecordsText="No submissions to display." CommandItemDisplay="Top" CommandItemSettings-ShowAddNewRecordButton="false" AllowNaturalSort="False">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="PractitionerID" MasterKeyField="PractitionerID"></telerik:GridRelationFields>
                    </ParentTableRelation>
                    <ExpandCollapseColumn Resizable="False">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>

                    <CommandItemSettings ShowAddNewRecordButton="False" ShowRefreshButton="False"></CommandItemSettings>

                    <Columns>
                        <telerik:GridBoundColumn DataField="SubmissionDate" DataType="System.String" HeaderText="SubmissionDate" SortExpression="SubmissionDate" UniqueName="SubmissionDate" DataFormatString="{0:D}">
                        </telerik:GridBoundColumn>

                        <telerik:GridBoundColumn DataField="PractitionerID" DataType="System.Int16" HeaderText="PractitionerID" SortExpression="PractitionerID" UniqueName="PractitionerID" Display="false">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <DetailTables>

                        <telerik:GridTableView DataKeyNames="PractitionerID" DataSourceID="SqlDataSource1" Width="100%"
                            runat="server"
                            Name="DetailsDetailsTable"
                            CommandItemDisplay="Top" CommandItemSettings-ShowAddNewRecordButton="false">

                            <ExpandCollapseColumn Resizable="False" Visible="false">
                                <HeaderStyle Width="20px" />
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridBoundColumn DataField="PractitionerID" DataType="System.Int16" HeaderText="PractitionerID" SortExpression="PractitionerID" UniqueName="PractitionerID" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PatientName" FilterControlAltText="Filter PatientName column" HeaderText="Patient" SortExpression="PatientName" UniqueName="PatientName">
                                </telerik:GridBoundColumn>

                                <telerik:GridBoundColumn DataField="InsuranceClaimBatchIDX" DataType="System.Int32" FilterControlAltText="Filter InsuranceClaimBatchIDX column" HeaderText="InsuranceClaimBatchIDX" SortExpression="InsuranceClaimBatchIDX" UniqueName="InsuranceClaimBatchIDX" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="InsuranceClaimsIDX" DataType="System.Int32" FilterControlAltText="Filter InsuranceClaimsIDX column" HeaderText="InsuranceClaimsIDX" ReadOnly="True" SortExpression="InsuranceClaimsIDX" UniqueName="InsuranceClaimsIDX" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ClientID" DataType="System.Int32" FilterControlAltText="Filter ClientID column" HeaderText="ClientID" SortExpression="ClientID" UniqueName="ClientID" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="InsuredIDNumber" FilterControlAltText="Filter InsuredIDNumber column" HeaderText="Insured ID" SortExpression="InsuredIDNumber" UniqueName="InsuredIDNumber">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="DOB" DataType="System.DateTime" FilterControlAltText="Filter DOB column" HeaderText="DOB" SortExpression="DOB" UniqueName="DOB" DataFormatString="{0:MM/dd/yyyy}" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ICD10Code" FilterControlAltText="Filter ICD10Code column" HeaderText="ICD10Code" SortExpression="ICD10Code" UniqueName="ICD10Code" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="APTCPTCode" DataType="System.Int32" FilterControlAltText="Filter APTCPTCode column" HeaderText="CPT" SortExpression="APTCPTCode" UniqueName="APTCPTCode">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PayID" DataType="System.Int32" FilterControlAltText="Filter PayID column" HeaderText="PayID" SortExpression="PayID" UniqueName="PayID" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="RenderingNPI" FilterControlAltText="Filter RenderingNPI column" HeaderText="RenderingNPI" SortExpression="RenderingNPI" UniqueName="RenderingNPI" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="GroupNPI" FilterControlAltText="Filter GroupNPI column" HeaderText="GroupNPI" SortExpression="GroupNPI" UniqueName="GroupNPI" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ServiceDate" DataType="System.DateTime" FilterControlAltText="Filter ServiceDate column" HeaderText="Service Date" SortExpression="ServiceDate" UniqueName="ServiceDate" DataFormatString="{0:MM/dd/yyyy}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Units" DataType="System.Int32" FilterControlAltText="Filter Units column" HeaderText="Units" SortExpression="Units" UniqueName="Units">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ServiceAmount" DataType="System.Decimal" FilterControlAltText="Filter ServiceAmount column" HeaderText="Service Amount" SortExpression="ServiceAmount" UniqueName="ServiceAmount" DataFormatString="{0:c}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Total" DataType="System.Decimal" FilterControlAltText="Filter Total column" HeaderText="Total" SortExpression="Total" UniqueName="Total" DataFormatString="{0:c}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="InvoiceAmountPaid" DataType="System.Decimal" FilterControlAltText="Filter InvoiceAmountPaid column" HeaderText="Invoice Amount Paid" SortExpression="InvoiceAmountPaid" UniqueName="InvoiceAmountPaid" DataFormatString="{0:c}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ClaimAmt" DataType="System.Decimal" FilterControlAltText="Filter ClaimAmt column" HeaderText="Claim Amt" SortExpression="ClaimAmt" UniqueName="ClaimAmt" DataFormatString="{0:c}" Aggregate="Sum" FooterText="$">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="SubmissionDate" DataType="System.DateTime" FilterControlAltText="Filter SubmissionDate column" HeaderText="Submission Date" SortExpression="SubmissionDate" UniqueName="SubmissionDate" DataFormatString="{0:MM/dd/yyyy}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ERA_ServiceInfokey" DataType="System.Int32" FilterControlAltText="Filter ERA_ServiceInfokey column" HeaderText="ERA_ServiceInfokey" SortExpression="ERA_ServiceInfokey" UniqueName="ERA_ServiceInfokey" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Adjudicated" FilterControlAltText="Filter Adjudicated column" HeaderText="Adjudicated" ReadOnly="True" SortExpression="Adjudicated" UniqueName="Adjudicated">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PaymentDate" DataType="System.DateTime" FilterControlAltText="Filter PaymentDate column" HeaderText="Cheque / EFT Date" SortExpression="PaymentDate" UniqueName="PaymentDate" DataFormatString="{0:MM/dd/yyyy}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ClaimAmtPaid" DataType="System.Decimal" FilterControlAltText="Filter ClaimAmtPaid column" HeaderText="Claim Amt Paid" SortExpression="ClaimAmtPaid" UniqueName="ClaimAmtPaid" DataFormatString="{0:c}" Aggregate="Sum" FooterText="$">
                                </telerik:GridBoundColumn>

                                <telerik:GridBoundColumn DataField="ClaimAdjustmentGroupCode" FilterControlAltText="Filter ClaimAdjustmentGroupCode column" HeaderText="Adj Group Code" SortExpression="ClaimAdjustmentGroupCode" UniqueName="ClaimAdjustmentGroupCode">
                                    <ItemStyle Width="100px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AdjustmentAmount" DataType="System.Decimal" FilterControlAltText="Filter AdjustmentAmount column" HeaderText="Adj Amount" SortExpression="AdjustmentAmount" UniqueName="AdjustmentAmount" DataFormatString="{0:c}">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ClassAmtUnpaid" DataType="System.Decimal" FilterControlAltText="Filter ClassAmtUnpaid column" HeaderText="Claim Amt Unpaid" SortExpression="ClassAmtUnpaid" UniqueName="ClassAmtUnpaid" DataFormatString="{0:c}" Aggregate="Sum" FooterText="$">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <PagerStyle Position="TopAndBottom" />
                        </telerik:GridTableView>
                    </DetailTables>
                    <PagerStyle Position="TopAndBottom" />
                </telerik:GridTableView>
            </DetailTables>
        </MasterTableView>
        <PagerStyle Mode="NextPrev" PageSizes="10;20;50;100" Position="TopAndBottom" />
    </telerik:RadGrid>

  6. david
    david avatar
    210 posts
    Member since:
    May 2007

    Posted 28 Jun in reply to david Link to this post

    Ok, figured it out;  The DataKeyNames of the 2nd level details table did not match the <ParentTableRelation> DetailKeyField values nor their order. Amazing it even worked partially.

     

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017