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

Recover data in Hierachical GridView

5 Answers 93 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bruno
Top achievements
Rank 1
Bruno asked on 08 Mar 2011, 06:16 PM

Hello,


I am working with a hierarchical GridView and I'd like to recover the information displayed on the child part I just clicked on (where there is a "+" sign).

So how can I access the informations displayed on this child part when entering the following function :

 

 

private

 

 

void OnGridViewMyChildViewExpanding(object sender, ChildViewExpandingEventArgs childViewExpandingEventArgs)  ?

I tried several tricks with the sender and the childViewExpandingEventArgs  objects, but with no results until now.

Thank you.

 

5 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 08 Mar 2011, 07:47 PM
Hello Bruno,

You can get to the ChildRows of the parent row that you are expanding in the following way

this.radGridView1.ChildViewExpanding += new ChildViewExpandingEventHandler(radGridView1_ChildViewExpanding);

void radGridView1_ChildViewExpanding(object sender, ChildViewExpandingEventArgs e)
{
    foreach (GridViewRowInfo childRow in e.ParentRow.ChildRows)
    {
        MessageBox.Show(childRow.Cells["childColumnName"].Value.ToString());
    }
}

Hope that helps
Richard
0
Bruno
Top achievements
Rank 1
answered on 09 Mar 2011, 10:01 AM

Thank you for your answer.

Unfortunately, when trying your solution, i find that ParentRow.ChildRows  is null, so I cannot have access to the cells.
0
Richard Slade
Top achievements
Rank 2
answered on 09 Mar 2011, 10:10 AM
Hello Bruno,

What version of the controls are you using? I have tried this with the latest Q3 2010 SP1 release and all works fine.
Regards,
Richard
0
Bruno
Top achievements
Rank 1
answered on 09 Mar 2011, 11:17 AM
Hello,

Sorry, it appeared that we are working with a derived version of Telerik GridView, and some behaviours have been modified.
That's why ChildRow is not initialized.
0
Richard Slade
Top achievements
Rank 2
answered on 09 Mar 2011, 11:19 AM
Hi Bruno,

Ok, well that would certainly be the way to get to it. If you need further help please let me know and if you found my answer helpful, please remember to mark as answer
Thanks
Richard
Tags
GridView
Asked by
Bruno
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Bruno
Top achievements
Rank 1
Share this question
or