This question is locked. New answers and comments are not allowed.

varsha Motwani
Top achievements
Rank 1
varsha Motwani
asked on 08 Jun 2010, 11:20 AM
Hi,
Can you please tell me how to get selected items of child table in Nested grid.
I want to acess the selected items in Child gird.
Can you please tell me how to get selected items of child table in Nested grid.
I want to acess the selected items in Child gird.
3 Answers, 1 is accepted
0
Accepted
Hello varsha Motwani,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I am sending you a sample project showing a possible way of getting to the nested grid items. In this example, on clicking the button, the visibility of a column from the child grid is set to collapsed.
I hope that helps.
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Keith Stephens
Top achievements
Rank 1
answered on 13 Oct 2010, 09:43 PM
What if you added another child gridview to the parent.
I have a senerio where I have a parent gridview with 2 child gridviews and in the second child gridview I have a combobox and when the user selects a "Title" from the drop down I want to change the rest of the cells.
So you select a title and then the author and publisher cells get updated from my object.
The title, author, publisher is an example of what I am trying to do.
Below is your xaml sample with another gridview added.
And the below c# code is my code for trying to get the selected index value so I can set my object with the new values from the selected title.
I have a senerio where I have a parent gridview with 2 child gridviews and in the second child gridview I have a combobox and when the user selects a "Title" from the drop down I want to change the rest of the cells.
So you select a title and then the author and publisher cells get updated from my object.
The title, author, publisher is an example of what I am trying to do.
Below is your xaml sample with another gridview added.
And the below c# code is my code for trying to get the selected index value so I can set my object with the new values from the selected title.
<
telerik:RadGridView
Grid.Row
=
"0"
Name
=
"clubsGrid"
ItemsSource
=
"{Binding Clubs}"
AutoGenerateColumns
=
"False"
IsSynchronizedWithCurrentItem
=
"True"
Margin
=
"5"
>
<
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:GridViewTableDefinition
/>
</
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Established}"
Header
=
"Est."
DataFormatString
=
"{}{0:yyyy}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding StadiumCapacity}"
Header
=
"Stadium"
DataFormatString
=
"{}{0:N0}"
/>
</
telerik:RadGridView.Columns
>
<
telerik:RadGridView.HierarchyChildTemplate
>
<
DataTemplate
>
<
Grid
>
<
telerik:RadGridView
Name
=
"playersGrid"
ItemsSource
=
"{Binding Players}"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Number}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Position}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Country}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
<
telerik:RadGridView
Name
=
"playersGrid2"
ItemsSource
=
"{Binding Players}"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Number}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Position}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Country}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
</
DataTemplate
>
</
telerik:RadGridView.HierarchyChildTemplate
>
</
telerik:RadGridView
>
private void rcboRateNotes_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
//int CurIdx = gdvTshipRates.Items.IndexOf(gdvTshipRates.CurrentItem);
int CurIdx;
RadComboBox cmbo = (RadComboBox)sender;
var row = cmbo.ParentOfType<
GridViewRow
>();
var childGrids = this.gdvTshipRates.ChildrenOfType<
GridViewDataControl
>();
var item = childGrids[0].SelectedItem;
var item2 = childGrids[1].SelectedItem;
var selectedRow = (GridViewRow)this.gdvTshipRates.ItemContainerGenerator.ContainerFromItem(this.gdvTshipRates.SelectedItem);
var childGrid = selectedRow.ChildrenOfType<
GridViewDataControl
>().FirstOrDefault();
var childGridcnt = selectedRow.ChildrenOfType<
GridViewDataControl
>().Count;
//if (childGrid != null)
//{
// childGrid.Columns[1].IsVisible = false;
//}
//if (row != null)
//{
// TShipNote club = row.DataContext as TShipNote;
// // AllRateNotes club = row.DataContext as AllRateNotes;
// CurIdx= gdvTshipRates.Items.IndexOf(club);
// if (CurIdx >= 0)
// {
// if (e.AddedItems != null && e.AddedItems.Count == 1)
// {
// RateNotes lCode = e.AddedItems[0] as RateNotes;
// AllRateNotes2[CurIdx].NoteNum = lCode.NoteNum;
// AllRateNotes2[CurIdx].SecLevel = lCode.SecLevel;
// AllRateNotes2[CurIdx].NoteLevel = lCode.NoteLevel;
// AllRateNotes2[CurIdx].NoteClass = lCode.NoteClass;
// AllRateNotes2[CurIdx].NoteBody = lCode.NoteBody;
// }
// //gdvTshipRates.Rebind();
// }
// else //It's a new row.
// {
// //a new item
// if (e.AddedItems.Count != 0)
// {
// CurIdx = AAgentAgreement.Count - 1;
// RateNotes lCode = e.AddedItems[0] as RateNotes;
// AllRateNotes2[CurIdx].NoteNum = lCode.NoteNum;
// AllRateNotes2[CurIdx].SecLevel = lCode.SecLevel;
// AllRateNotes2[CurIdx].NoteLevel = lCode.NoteLevel;
// AllRateNotes2[CurIdx].NoteClass = lCode.NoteClass;
// AllRateNotes2[CurIdx].NoteBody = lCode.NoteBodyLines2;
// }
// }
//}
}
0
Hello Keith Stephens,
Maya
the Telerik team
In order to make our communication consistent, I would suggest to keep it on the other forum thread you started.
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items