Home Forums WinForms controls Xceed Grid for WinForms How make synchronization of two grid,when sort one grid Reply To: How make synchronization of two grid,when sort one grid

User (Old forums)
Member
Post count: 23064

Handle the SortDirectionChanged event on Column to manually synchronize the other grid.

private void Form1_Load( object sender, EventArgs e )

{

    foreach( Column col in gridControl1.Columns )

    {

        col.SortDirectionChanged +=

new EventHandler( col_SortDirectionChanged );

    }

}

void col_SortDirectionChanged( object sender, EventArgs e )

{

    Column col = sender as Column;

    if( col != null )

    {

        if( col.SortDirection == SortDirection.Ascending )

        {

            //Sort the other grid’s corresponding column in Ascending order

            //You can use the col.FieldName to identify the column.

        }

        else if( col.SortDirection == SortDirection.Descending )

        {

            //Sort the other grid’s corresponding column in Descending order

        }

    }

}

 

Imported from legacy forums. Posted by André (had 473 views)