Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / UltraWinGrid: Select All GroupBy and Data Rows

UltraWinGrid: Select All GroupBy and Data Rows

New Discussion
Megumi
Megumi asked on Sep 28, 2017 2:23 PM

Hello,

I have a UltraWinGrid which has at least one GroupBy column (Outlook Group By).  I want to select all GroupByRows and Data rows on the grid (Even the ones invisible.  I have a function to export the selected rows to excel).  I have problems with selecting ChildBand’s (lower level GroupByRows and Data rows).

I can select the first level GroupByRows by this.

theUltraGrid.Selected.Rows.AddRange(theUltraGrid.Rows.All)

 

However, I get ‘NullReferenceException’ when I try to add ChildBand’s rows to SelectedRows.

I am doing something like this. (In the real code I do it recursively)

theUltraGrid.Selected.Rows.AddRange(theUltraGrid.Rows(0).ChildBands(0).Rows.All)

I get the following exception.

{“Object reference not set to an instance of an object.”} at Infragistics.Win.UltraWinGrid.Selected.SelectionPositionSortComparer.CompareRow(UltraGridRow rowX, UltraGridRow rowY) …

I tried it in several different ways but I always get the same exception.  I am wondering if my code has problems or the way I do is completely wrong.  Please give me advice.

Thanks!

Sign In to post a reply

Replies

  • 0
    Mike Saltzman
    Mike Saltzman answered on Sep 5, 2008 2:46 PM

    There are two problems here.

    First, you cannot select rows on more than one level at a time. This means you cannot select a GroupByRow and one of it's child rows at once. If you select a child rows, the GroupByRow will be de-selected. 

    I think the second issue is with how you are getting the child rows. If the grid is grouped, then theUltraGrid.Rows(0) will be a GroupByRow. A GroupByRow will never have a ChildBands collection. ChildBands only exist on data rows. What you need to do is cast the row into an UltraGridGroupByRow and use the Rows collection to get it's child rows.

    • 0
      Megumi
      Megumi answered on Sep 5, 2008 2:56 PM

      Hello Mike,

      Thanks for the reply!  I will try to figure out what I can do to make my functionalities work with your advice!  Probably I will think of something using UltraGridGroupByRow as you taught me!

      Thanks alot!!!

      • 0
        anand e
        anand e answered on Dec 30, 2011 7:10 AM

        Hi

        could you post a sample code for this?

    • 0
      chandra
      chandra answered on Sep 25, 2012 10:28 PM

      Hi Mike,

                 I have similar issue to select all rows under GroupByRow in an UltraWinGrid. My UltraWinGrid contains bunch of GroupByRows. If I select any GroupByRow, 

      it should select all the respective datarows. Here is my sample code:

           foreach(UltraGridRow row in this.Grid.Selected.Rows)

           {

             if (row is UltraGridGroupByRow)

              {

                 UltraGridGroupByRow groupByRow = row as UltraGridGroupByRow;

           RowsCollection rows = groupByRow.Rows; 

           Grid.Selected.Rows.AddRange((UltraGridRow[])rows.All); //Throwing NullReferenceException

          }

       }

      Could please help me to resolve this and let me know if you need more information. Thank you.

       

      • 0
        Mike Saltzman
        Mike Saltzman answered on Sep 26, 2012 2:54 PM

        Why are you getting a NullReferenceException? What is null?

      • 0
        chandra
        chandra answered on Sep 26, 2012 3:00 PM

        Hi Mike, If I clear the previous selected rows before adding new data rows then it is working fine.

        Grid.Selected.Rows.Clear();

        Grid.Selected.Rows.AddRange((UltraGridRow[])rows.All);

         

        Thanks,

        Kudumula.

      • 0
        ganesh khare
        ganesh khare answered on Sep 27, 2017 12:03 PM

        Hi Mike,

        PFA please suggest me how can i (un)checked group level checkbox on all child (un)checked 

    • 0
      ganesh khare
      ganesh khare answered on Aug 14, 2017 7:29 AM

      Hi Mike,

       My requirement like as above mention description but i am not able to do that can you help me for that 

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Megumi
Favorites
0
Replies
8
Created On
Sep 28, 2017
Last Post
8 years, 5 months ago

Suggested Discussions

Tags

Created by

Created on

Sep 28, 2017 2:23 PM

Last activity on

Feb 20, 2026 1:12 PM