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

[Solved] Access current DetailsView in selected Row

1 Answer 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Juan
Top achievements
Rank 1
Juan asked on 02 Sep 2010, 05:53 PM
Hello,

I have a GridView which has a DataTemplate defined for its DetailsView, and the Details view show up when the user clicks on any row, the Details are internal to the grid, but the template for the details is part of a resource of the page.

I can get access to the Grid holding the items for the template when an event is raised inside the details view, but I am unable to get a lock on the same details view from an event raised outside the gridview.

looking aroud I get a lock to the current selected row using:

GridViewRow selectedRow = radGridViewData.ItemContainerGenerator.ContainerFromItem(radGridViewData.SelectedItem) as GridViewRow;
But from here I am lost, I need to modify some field inside the details view from a button out of the grid.

Thanks;
Juan Mejia



1 Answer, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 03 Sep 2010, 08:37 AM
Hello Juan,

Use the extension method ChildrenOfType<T>.

For example, if you had a Grid inside your row details template:

var grid = (Grid)selectedRow.ChildrenOfType<DetailsPresenter>()[0].Content;

I hope this helps.

Regards,
Ross
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
Tags
GridView
Asked by
Juan
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or