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

Extract Summary row information

2 Answers 83 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 19 Apr 2013, 06:01 PM
Hi, i have done some column grouping in the grid with the summary information displaying correctly. 

What i want to do now is to export this summary / or loop through the rows (only system row that contains the summary...not the underlying rows containing the data), is there any way to do this ?

Thank you

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Petrov
Telerik team
answered on 24 Apr 2013, 03:36 PM
Hi Martin,

Thank you for writing.

The easiest way to achieve your goal would be to use the grid traverser created for the printing functionality. This traverser goes through all grid rows no matter if they are currently visible or not. You can then check whether the current row of the traverser is a group row and if it is to export it to the storage you want. Here is an example:
private void radButton1_Click(object sender, EventArgs e)
{
    PrintGridTraverser traverser = new PrintGridTraverser(this.radGridView1.MasterView);
    traverser.ProcessHierarchy = true;
    traverser.TraversalMode = GridTraverser.TraversalModes.AllRows;
 
    StringBuilder sb = new StringBuilder();
 
    while (traverser.MoveNext())
    {
        GridViewGroupRowInfo groupRow = traverser.Current as GridViewGroupRowInfo;
 
        if (groupRow != null)
        {
            string summaryString = groupRow.HeaderText;
            sb.AppendLine(summaryString);
        }
    }
 
    MessageBox.Show(sb.ToString());
}

I hope this will be useful. Should you have further questions, I would be glad to help.

Kind regards,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Martin
Top achievements
Rank 1
answered on 24 Apr 2013, 08:10 PM
That's exactly what i wanted !
Tags
GridView
Asked by
Martin
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Martin
Top achievements
Rank 1
Share this question
or