Extract Summary row information

3 posts, 1 answers
  1. Martin
    Martin avatar
    2 posts
    Member since:
    Mar 2012

    Posted 19 Apr 2013 Link to this post

    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. Answer
    Ivan Petrov
    Admin
    Ivan Petrov avatar
    717 posts

    Posted 24 Apr 2013 Link to this post

    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.
  3. Martin
    Martin avatar
    2 posts
    Member since:
    Mar 2012

    Posted 24 Apr 2013 Link to this post

    That's exactly what i wanted !
Back to Top