Dear Sir\Madam,
Telerik radgrid gridbound column is showing all the selected columns,but the detail table showing few blank column and then the details.how to avoid that blank rows which are showing in detail table.Please help.
7 Answers, 1 is accepted
Telerik radgrid gridbound column is showing all the selected columns,but the detail table showing few blank rows and then the details.how to avoid that blank rows which are showing in detail table.Please help.
here am mentioning the code also;
<telerik:RadGrid ID="Radgrid1" runat="server" OnNeedDataSource="Radgrid1_NeedDataSource" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" GridLines="None" Skin="WebBlue" AutoGenerateColumns="False" OnDetailTableDataBind="Radgrid1_DetailTableDataBind" >
<ExportSettings ExportOnlyData="True">
</ExportSettings>
<ClientSettings EnableRowHoverStyle="true" >
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
<MasterTableView AutoGenerateColumns="false" ShowHeadersWhenNoRecords="true" >
<CommandItemSettings ExportToPdfText="Export to PDF" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="p_order" HeaderText="OrderNo" AllowFiltering="true" UniqueName="p_order" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="name" HeaderText="SupplierName" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="location" HeaderText="Location" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="entry_date" HeaderText="EntryDate" AllowFiltering="true" >
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView NoDetailRecordsText="" ShowHeadersWhenNoRecords="false" PageSize="20" >
<CommandItemSettings ExportToPdfText="Export to PDF" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="order_no" HeaderText="OrderNo" AllowFiltering="true" UniqueName="p_order" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="barcode" HeaderText="Barcode" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="supp_ref" HeaderText="Supplier Reference" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="prod_desc" HeaderText="Description" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="brand" HeaderText="Brand" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="unit_cost" HeaderText="Unit Cost" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="order_qtypc" HeaderText="Order Qty" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="rec_qty" HeaderText="Received Qty" AllowFiltering="true" >
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Black">
</HeaderContextMenu>
</telerik:RadGrid>
The behavior you describe seems rather strange. By default there should be no empty rows in the detail table. This could happen if there are some rows with empty values in the data source. Would you check the data source and ensure that there are no null or empty values there?
Regards,
Viktor Tachev
Telerik
Hi,
My detail table looks as attached. My radgrid does not show the detail table. Please help me.
Attached is my code.
Thank you.
<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="OPERATOR" 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>
</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 %>" SelectCommand="SELECT TOP (20) SYS_DT_TM, TRANS_ID, START_LOC, END_LOC, LOAD_ID, USER_ID FROM TRANS WHERE USER_ID = @OPERATOR order by SYS_DT_TM DESC">
<SelectParameters>
<asp:ControlParameter Name ="OPERATOR" ControlID="Label11" PropertyName ="Text"/>
</SelectParameters>
</asp:SqlDataSource>
This is probably related to the binding of the grid. I'm afraid using programmatic NeedDataSource and declarative DataSourceID is not supported for the same grid hierarchy. You should use either only the programmatic (with DetailTableDataBind event handler) or the declarative approach:
https://www.telerik.com/support/kb/aspnet-ajax/grid/details/how-to-bind-radgrid-properly-on-server-side
If you decide to use the DataSourceID approach, pay attention to the SelectParameters of the SqlDataSource controls. You will notice in the following live sample that they are of type SessionParameter and with different names, i.e. CustomerID and OrderID:
https://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarative-relations/defaultcs.aspx
Also, you can temporarily disable AJAX while developing and troubleshooting your application:
https://www.telerik.com/support/kb/aspnet-ajax/ajaxmanager/details/get-more-descriptive-errors-by-disabling-ajax
I hope this will prove helpful.
Regards,
Eyup
Progress Telerik