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

Set DetailsVisibility in code

1 Answer 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 04 Jan 2010, 11:07 AM
Hi,

I want to show the details for a specifict row in the grid. I can do this today if I have a button in one cell in the row like this:

Button

 arr = (Button)sender;

 

 

parentRow = arr.ParentOfType<Telerik.Windows.Controls.GridView.

 

 

GridViewRow>();

 

//Toggle-like functionality

 

if (parentRow.DetailsVisibility == Visibility.Visible)

parentRow.DetailsVisibility =

Visibility.Collapsed;

 

else

 

parentRow.DetailsVisibility =

Visibility.Visible;

But I want to open the details from anywhere. For example I have a button which add a new post in the grid and I want to open this post/rows details. How do I do that?

Thanks,

/R

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Raymond
Top achievements
Rank 1
answered on 04 Jan 2010, 11:15 AM

I solved it:

 

grd.UpdateLayout();

Telerik.Windows.Controls.GridView.

GridViewRow row = grd.ItemContainerGenerator.ContainerFromItem(newPost) as Telerik.Windows.Controls.GridView.GridViewRow;

 

row.DetailsVisibility =

Visibility.Visible;

 

Tags
GridView
Asked by
Raymond
Top achievements
Rank 1
Answers by
Raymond
Top achievements
Rank 1
Share this question
or