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;
            }
        }
    }
}