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

Radgrid's detail table doesn't display at all

5 Answers 240 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Asim
Top achievements
Rank 1
Asim asked on 28 Oct 2013, 03:24 AM
I am using radgrid control and trying to populate a detail table with it. But records are being displayed in the master table but detail table is not being displayed at all.

aspx
  <telerik:RadGrid ID="radBusinessParentDetail"
        runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
        DataSourceID="SqlDataSourcePaymentMaster"
        AllowPaging="false" EnableLinqExpressions="false" GridLines="None" ShowStatusBar="true">
        <ClientSettings AllowExpandCollapse="True"></ClientSettings>
        <MasterTableView DataKeyNames="RecordId" AllowMultiColumnSorting="True" HierarchyLoadMode="Client" Width="100%">
            <DetailTables>
                <telerik:GridTableView Name="PaymentDetail" AutoGenerateColumns="true"
                    DataKeyNames="PaymentScheduleId" Width="100%" DataSourceID="SqlDataSourcePaymentDetail">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="PaymentScheduleId" MasterKeyField="RecordId">
                        </telerik:GridRelationFields>
                    </ParentTableRelation>
                    <Columns>
                            <telerik:GridBoundColumn DataField="PaidDate" HeaderText="Paid On" SortExpression="PaidDate" DataFormatString="{0:dd/MM/yyyy}"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn Aggregate="Sum" DataField="AmountPaid" HeaderText="Amount Paid" SortExpression="AmountPaid"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn Aggregate="Sum" DataField="Commission" HeaderText="Commission" SortExpression="Commission"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn Aggregate="Sum" DataField="GST" HeaderText="GST" SortExpression="GST"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn Aggregate="Sum" DataField="NetReceived" HeaderText="Net" SortExpression="NetReceived"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="PaymentMethod" HeaderText="Payment Method" SortExpression="PaymentMethod"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Comment" HeaderText="Comment" SortExpression="Comment"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="MiscField" HeaderText="Terminal ID" SortExpression="MiscField"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="IsCommissionPaid" HeaderText="Commission Paid"></telerik:GridBoundColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                    <telerik:GridBoundColumn DataField="RecordId" HeaderText="RecordId" SortExpression="RecordId" UniqueName="RecordId"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn Aggregate="Count" DataField="InstallmentNo" HeaderText="Inst. No"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="DueDate" HeaderText="Due On" SortExpression="DueDate" DataFormatString="{0:dd/MM/yyyy}"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn Aggregate="Sum" DataField="AmountDue" HeaderText="Amount Due" SortExpression="AmountDue"></telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSourcePaymentMaster" ConnectionString="<%$ ConnectionStrings:COMS %>"
        ProviderName="System.Data.SqlClient"
        SelectCommand = "select RecordId, InstallmentNo, DueDate, AmountDue from paymentschedule where studentid='1302438' and isrefunded=0"
        runat="server">
 
</asp:SqlDataSource>
 
<asp:SqlDataSource ID="SqlDataSourcePaymentDetail" ConnectionString="<%$ ConnectionStrings:COMS %>"
        ProviderName="System.Data.SqlClient" SelectCommand="select
                            PaidDate, Commission, NetReceived, GST, PaymentMethod, Comment, MiscField
                            from paymentscheduledetail where PaymentScheduleId=@RecordId"
        runat="server">
        <SelectParameters>
            <asp:SessionParameter Name="RecordId" SessionField="RecordId" Type="Int32">
            </asp:SessionParameter>
        </SelectParameters>
    </asp:SqlDataSource>

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Oct 2013, 04:28 AM
Hi Asim,

Please modify your select query as shown below and see if it helps.Add PaymentScheduleId to the select command.

ASPX:
<asp:SqlDataSource ID="SqlDataSourcePaymentDetail" ConnectionString="<%$ ConnectionStrings:COMS %>"
ProviderName="System.Data.SqlClient" SelectCommand="select PaymentScheduleId, PaidDate, Commission,
NetReceived, GST, PaymentMethod, Comment, MiscField from paymentscheduledetail where PaymentScheduleId=@RecordId" runat="server">
        <SelectParameters>
            <asp:SessionParameter Name="RecordId" SessionField="RecordId" Type="Int32">
            </asp:SessionParameter>
        </SelectParameters>
    </asp:SqlDataSource>

Thanks,
Princy
0
Asim
Top achievements
Rank 1
answered on 28 Oct 2013, 04:35 AM
Hi Princy,
Thanks for the reply. But problem is still the same. please have a look at the attachment.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Oct 2013, 09:48 AM
Hello,

I have tried with the below code snippet and its works for me. Please try with the below code snippet and let me know if any concern.

<telerik:RadGrid ID="radBusinessParentDetail"
           runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
           DataSourceID="SqlDataSourcePaymentMaster"
           AllowPaging="false" EnableLinqExpressions="false" GridLines="None" ShowStatusBar="true">
           <ClientSettings AllowExpandCollapse="True"></ClientSettings>
           <MasterTableView DataKeyNames="RecordId" AllowMultiColumnSorting="True" HierarchyLoadMode="Client" Width="100%">
               <DetailTables>
                   <telerik:GridTableView Name="PaymentDetail"
                       DataKeyNames="PaymentScheduleId" Width="100%" DataSourceID="SqlDataSourcePaymentDetail">
                       <ParentTableRelation>
                           <telerik:GridRelationFields DetailKeyField="PaymentScheduleId" MasterKeyField="RecordId"></telerik:GridRelationFields>
                       </ParentTableRelation>
                       <Columns>
                           <telerik:GridBoundColumn DataField="NetReceived" HeaderText="NetReceived"></telerik:GridBoundColumn>
                       </Columns>
                   </telerik:GridTableView>
               </DetailTables>
               <Columns>
                   <telerik:GridBoundColumn DataField="RecordId" HeaderText="RecordId" SortExpression="RecordId" UniqueName="RecordId"></telerik:GridBoundColumn>
                   <telerik:GridBoundColumn Aggregate="Count" DataField="InstallmentNo" HeaderText="Inst. No"></telerik:GridBoundColumn>
               </Columns>
           </MasterTableView>
       </telerik:RadGrid>
       <asp:SqlDataSource ID="SqlDataSourcePaymentMaster" runat="server" ConnectionString="<%$ ConnectionStrings:JayeshTestConnectionString %>"
           SelectCommand="SELECT [RecordId], [InstallmentNo] FROM [paymentschedule]"></asp:SqlDataSource>
       <asp:SqlDataSource ID="SqlDataSourcePaymentDetail" runat="server" ConnectionString="<%$ ConnectionStrings:JayeshTestConnectionString %>"
           SelectCommand="SELECT [PaidDate], [PaymentScheduleId], [NetReceived], [paymentscheduledetailId] FROM [paymentscheduledetail] WHERE ([PaymentScheduleId] = @PaymentScheduleId)">
           <SelectParameters>
               <asp:SessionParameter Name="PaymentScheduleId" SessionField="RecordId" Type="Int32" />
           </SelectParameters>
       </asp:SqlDataSource>

Note :
<SelectParameters>
               <asp:SessionParameter Name="PaymentScheduleId" SessionField="RecordId" Type="Int32" />
           </SelectParameters>


Thanks,
Jayesh Goyani
0
Kiran
Top achievements
Rank 1
answered on 23 Apr 2019, 12:47 PM

Same Issue. Please Help.

 

     <asp:UpdatePanel ID="UpdatePanel1" runat="server">
         <ContentTemplate>
           <telerik:RadGrid ID="RG_OPERATORS" AutoGenerateColumns="false" AllowSorting="TRUE" runat="server" Skin="Black" ShowFooter="True" OnNeedDataSource="RG_OPERATORS_NeedDataSource" >
         <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Black">
                    </HeaderContextMenu>
        <MasterTableView DataKeyNames="SYS_ID,EMP_ID,SORT_PRIORITY, OPERATOR" EnableHierarchyExpandAll="true" Name="Master" AutoGenerateColumns="false" >
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column" />
            </EditFormSettings>
            <CommandItemSettings ExportToPdfText="Export to Pdf" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="False" />
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Created="True" />   
            <DetailTables>
                <telerik:GridTableView DataKeyNames="USER_ID" DataSourceID="SqlDataSource1" Width="100%" AllowSorting="true" EnableHierarchyExpandAll="true"  Name="DETAIL">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="USER_ID" MasterKeyField="OPERATOR" ></telerik:GridRelationFields>
                    </ParentTableRelation>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"   /> 
                    <Columns>
                        <telerik:GridBoundColumn DataField="SYS_DT_TM" DefaultInsertValue="" HeaderText="TRANS DATE" ReadOnly="True" SortExpression="SYS_DT_TM" UniqueName="TRANS_SYS_DT_TM" Visible="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="TRANS_ID" DefaultInsertValue="" HeaderText="TRANS ID" ReadOnly="True" SortExpression="TRANS_ID" UniqueName="TRANS_ID" Visible="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="START_LOC" DefaultInsertValue="" HeaderText="START LOC" ReadOnly="True" SortExpression="START_LOC" UniqueName="START_LOC" Visible="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="END_LOC" DefaultInsertValue="" HeaderText="END LOC" ReadOnly="True" SortExpression="END_LOC" UniqueName="END_LOC" Visible="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="LOAD_ID" DefaultInsertValue="" HeaderText="LOAD ID" ReadOnly="True" SortExpression="LOAD_ID" UniqueName="LOAD_ID" Visible="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="USER_ID" DefaultInsertValue="" HeaderText="USER ID" ReadOnly="True" SortExpression="USER_ID" UniqueName="USER_ID" Visible="True">
                        </telerik:GridBoundColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
  
                <telerik:GridBoundColumn DataField="SYS_ID" DefaultInsertValue="" 
                    HeaderText="SYS_ID" ReadOnly="True" SortExpression="SYS_ID" UniqueName="SYS_ID" Visible="FALSE">
                <ItemStyle Font-Size="12pt" ForeColor="White" HorizontalAlign="LEFT" />
                </telerik:GridBoundColumn>  

                 <telerik:GridBoundColumn DataField="OPERATOR" DefaultInsertValue=""  Aggregate="Count"
                    HeaderText="OPERATOR" ReadOnly="False" SortExpression="OPERATOR" UniqueName="OPERATOR" Visible="TRUE">
                    <ItemStyle  ForeColor="White" Font-Size="10pt" HorizontalAlign="LEFT" />
                </telerik:GridBoundColumn>  

                <telerik:GridBoundColumn DataField="DOCK_STATUS" DefaultInsertValue="" 
                    HeaderText="DOCK_STATUS" ReadOnly="False" SortExpression="DOCK_STATUS" UniqueName="DOCK_STATUS" Visible="TRUE">
                 <ItemStyle  ForeColor="White" Font-Size="10pt" HorizontalAlign="LEFT" />
                </telerik:GridBoundColumn>
                
                       <telerik:GridBoundColumn DataField="IB_ROUTES"   DefaultInsertValue="" 
                    HeaderText="IB_ROUTES" ReadOnly="False" SortExpression="IB_ROUTES" 
                    UniqueName="IB_ROUTES" Visible="TRUE">
                    <ItemStyle  ForeColor="WHITE" Font-Size="10pt" HorizontalAlign="LEFT" />
                </telerik:GridBoundColumn> 

                <telerik:GridBoundColumn DataField="PUNCH_STATUS" DefaultInsertValue="" 
                    HeaderText="PUNCH_STATUS" ReadOnly="False" SortExpression="PUNCH_STATUS" UniqueName="PUNCH_STATUS" Visible="TRUE">
                   <ItemStyle  ForeColor="White" Font-Size="10pt" HorizontalAlign="LEFT" />
                </telerik:GridBoundColumn>  

                <telerik:GridBoundColumn DataField="PUNCH_TIME" DefaultInsertValue="" 
                    HeaderText="PUNCH_TIME" ReadOnly="False" SortExpression="PUNCH_TIME" UniqueName="PUNCH_TIME" Visible="TRUE">
                    <ItemStyle ForeColor="White" Font-Size="10pt" HorizontalAlign="LEFT" />
                </telerik:GridBoundColumn>  

                <telerik:GridBoundColumn DataField="OPR_LAST_SCAN_DTTM" DefaultInsertValue="" 
                    HeaderText="LAST SCANNED DT TM" ReadOnly="False" SortExpression="OPR_LAST_SCAN_DTTM" UniqueName="OPR_LAST_SCAN_DTTM" Visible="TRUE">
                    <ItemStyle ForeColor="White" Font-Size="10pt" HorizontalAlign="LEFT" />
                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn DataField="OPR_LAST_SCAN_TRANSID" DefaultInsertValue="" 
                    HeaderText="LAST SCANNED TRANS ID" ReadOnly="False" SortExpression="OPR_LAST_SCAN_TRANSID" UniqueName="OPR_LAST_SCAN_TRANSID" Visible="TRUE">
                    <ItemStyle ForeColor="White" Font-Size="10pt" HorizontalAlign="LEFT" />
                </telerik:GridBoundColumn>
  

            </Columns> 
        </MasterTableView>
    </telerik:RadGrid>

         </ContentTemplate>
     </asp:UpdatePanel>


    <br />
    
    <asp:Label ID="Label11" runat="server" Visible="false" Text='<%# Eval("OPERATOR")%>'></asp:Label>
       <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FCSConnectionString %>" ProviderName="System.Data.SqlClient"
           SelectCommand="SELECT TOP (20) SYS_DT_TM, TRANS_ID, START_LOC, END_LOC, LOAD_ID, USER_ID FROM TRANS WHERE USER_ID = 'AVISCO' ORDER BY SYS_DT_TM DESC">
            <SelectParameters>
                 <asp:ControlParameter Name ="OPERATOR" ControlID="Label11"  PropertyName ="Text"/>
            </SelectParameters>
            </asp:SqlDataSource>

0
Eyup
Telerik team
answered on 25 Apr 2019, 04:31 PM
Hello Kiran,

I've already replied to your query in the other forum:
https://www.telerik.com/forums/radgrid-detail-table-showing-blank-rows#Ic5x96wJskuQEyA93cpJ1A

I suggest that we continue our technical conversation on the mentioned thread. Also, try to avoid opening duplicate threads so we can better focus on the specific questions and issues at hand.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Asim
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Asim
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Kiran
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or