Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1871
Select a single row with multiple group by rows.
posted

I was wondering if there was an easier way to select a specific row when multiple group by's are involved. Clearly the code below will allow me to select the row I am looking for with only one group by is used but it is useless if more than one is used.

Do I have to create a recursive loop to accomplish this?

If so probably not worth it. We select the row based on a row cell we know to be unique. In this case we pass in the customer to select and trap on it. Once the customer is found we select, activate the row and kick out.

if (this.grid.Rows.IsGroupByRows)
{
    foreach (UltraGridGroupByRow groupByRow in this.grid.Rows)
    {
        foreach (UltraGridRow row in groupByRow.Rows)
        {
            if (row.Cells["Cust_id"].Text == customerToSelect)
            {
                this.grid.ActiveRow = row;
                this.grid.ActiveRow.Selected = true;

                break;
            }
        }
    }
}

Parents
  • 34830
    Verified Answer
    Offline posted

    Hello Michael,

    The Rows collection of the UltraGrid actually has a method named GetAllNonGroupByRows that I believe would help you with this. Rather than trying to recursively loop through the GroupByRows, you can invoke:

    ultraGrid1.Rows.GetAllNonGroupByRows();

    Then loop through the resulting collection and select your row in the way you are currently doing.

    Please let me know if you have any other questions or concerns on this matter.

Reply Children
No Data