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

how to fill a RadGridView with headers and their details values from datatable?

4 Answers 195 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Oscar
Top achievements
Rank 1
Oscar asked on 06 Jan 2017, 05:53 PM

Hi,

I'm new in WPF and I would like to know is possible to display in a RadGridView the headers with their details?

I have two DataTable which the first keep the header values and the second Datatable keeps the details values from a database. I'm able to display the header values in the RadGridview but I couldn't find how to display their details for each header.

For Example:

The RadGridView shows the Sales Number, Sales date and total then when the user clicks in the Sales number row it displays the Sales details with all the products and their descriptions.

I would appreciate your help or any suggestions.

Regards,

Oscar

4 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 10 Jan 2017, 12:30 PM
Hi Oscar, 

Though I am not sure I understand your requirements thoroughly enough, I believe you are trying to implement some type of hierarchical RadGridView or show additional information about each row within the grid control. If this is the case, I suggest you check the following article from our documentation to find out more information on the how to show additional details of the row

- RadGridView - RowDetails Template

I suggest you also check the "Expand/Collapse Row Details" and "Row Details Template Selector" demos from our SDK Samples Browser.

Regards,
Stefan Nenchev
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Oscar
Top achievements
Rank 1
answered on 11 Jan 2017, 10:47 PM

Hi Stefan Nenchev,

Thanks for your advice, I'm checking the topics but I didn't make it. I used the RadGridView.ChildTableDefinitions to try to relation both datatables but those are not displayed in my RadGridView, this is the xaml code that I used:

 

<telerik:RadGridView  x:Name="radgridview1" ValidatesOnDataErrors="InEditMode" Grid.Row="0"  ShowGroupPanel="False" IsReadOnly="True"
                                           AutoGenerateColumns="False"
                                          DataMember="HeaderValues" ItemsSource="{Binding HeaderValues}" >
                        <telerik:RadGridView.ChildTableDefinitions>
                            <telerik:GridViewTableDefinition />
                        </telerik:RadGridView.ChildTableDefinitions>
                        <telerik:RadGridView.HierarchyChildTemplate>
                            <DataTemplate>
                                <telerik:RadGridView Name="radgridview1" AutoGenerateColumns="False" DataMember="DetailValues" ItemsSource="{Binding DetailValues}" ></telerik:RadGridView>
                            </DataTemplate>
                        </telerik:RadGridView.HierarchyChildTemplate>
                    </telerik:RadGridView>

HeaderValues and DetailValues are the DataTable that are filled from a connection to SQL

have I made something wrong?

 

Thansk for your help and suggestions

Oscar

0
Stefan Nenchev
Telerik team
answered on 16 Jan 2017, 11:00 AM
Hello Oscar,

It seems that you have made a mix of both approaches available for setting up a hierarchical grid. I have added a sample project that shows a hierarchical RadGridView bound to a DataTable. Please review it and consider such approach from your end. 

Regards,
Stefan Nenchev
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Oscar
Top achievements
Rank 1
answered on 16 Jan 2017, 11:25 PM

Hi Stefan Nenchev,

I reviewed your example, this was a a lot of help for me. Now is working fine.

thanks a lot of

Regards,

Oscar Hernandez

Tags
GridView
Asked by
Oscar
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Oscar
Top achievements
Rank 1
Share this question
or