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

RadGrud control - Issues in subgrid (DetailedTable)

3 Answers 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SENTHIL
Top achievements
Rank 1
SENTHIL asked on 25 Aug 2014, 05:21 AM
Hi,

I m using telerik rad grid control to populate the data's in parent and child tables structure. Both parent and child tables are dynamically popluated with different number of columns based on the input selection. The parent table is populating the values in all the times even number of output columns changed. But, the child tables are loaded correctly for the first timeonly. After that, we change the input field values and output for child table changed from the first time loading records, the child tables values are not refreshed. It shows the old records only. Thanks in advance.

Senthilraja. 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 25 Aug 2014, 05:51 AM
Hi SENTHIL,

Its hard to identify the issue with so less information. Can you provide your full code snippet so as to replicate the issue.

Thanks,
Princy
0
SENTHIL
Top achievements
Rank 1
answered on 25 Aug 2014, 04:04 PM

Hi Princy,

Thanks for your reply. Please find the detailed information about the implementation and issue as below

The RadGrid design in aspx (detailed table is used for subgrid)
<telerik:RadGrid ID="rdGrid" runat="server" BorderStyle="Solid" BorderWidth="2px" MasterTableView-HierarchyLoadMode="ServerBind" MasterTableView-GroupLoadMode="Server"
RetainExpandStateOnRebind="True" MasterTableView-AllowAutomaticDeletes="true" AllowMultiRowSelection="True" ShowGroupPanel="false">
<MasterTableView TableLayout="Fixed" AllowNaturalSort="False" HierarchyLoadMode="ServerBind" EnableColumnsViewState="false" EnableViewState="true">
<ExpandCollapseColumn Created="True">
</ExpandCollapseColumn>
<Columns>
</Columns>
<DetailTables>
<telerik:GridTableView Name="childTable1" runat="server" AutoGenerateColumns="true" AllowMultiColumnSorting="false" AllowNaturalSort="false" EnableColumnsViewState="false" Width="845px"
BorderStyle="Solid" HierarchyLoadMode="ServerBind" ShowFooter="false" BorderWidth="2px" Visible="true" RetainExpandStateOnRebind="false" EnableViewState="false" ViewStateMode="Disabled"
AllowMultiRowSelection="false" ShowHeader="false">
<Columns>
</Columns>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>

Binding child table in server-side

In Page load parent table will be loaded. The child table will be loaded in itemcommand event (Expand Command)

Private Sub rdGrid_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles rdGrid.ItemCommand
Dim dtGrid As New DataTable
dtGrid = GetDataSet()
rdGrid.MasterTableView.DetailTables.Item(0).DataSource = dtGrid
rdGrid.MasterTableView.DetailTables.Item(0).DataBind()
End Sub

Issue detail:

The columns settings for parent and child tables are autogenerate=true.

For parent table column data is loaded properly for dataset's having different number of columns based on input selection.

But, the child table records are loaded properly for first dataset load. If the dataset is changed (In number of columns or column type or column name) the child table is shows the old value only. The data binding for child table is not refreshed in second time grid loading.

Thanks.

Senthilraja
0
Eyup
Telerik team
answered on 28 Aug 2014, 11:15 AM
Hello Senthilraja,

Please note that using DataBind() to bind the grid is not recommended. Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
Declarative DataSource
Advanced Data Binding


And when you are implementing a hierarchical structure with programmatic binding, you should use the DetailTableDataBind event handler in addition to NeedDataSource:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/programmatic-hierarchy/defaultcs.aspx

Hope this helps.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
SENTHIL
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
SENTHIL
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or