Welcome to the Xceed Community | Help
Community Search  
More Search Options

DataGrid Sort Order

Sort Posts: Previous Next
  •  08-06-2009, 11:36 AM Post no. 23197

    DataGrid Sort Order

    Hello,

    I asked this question a while back but wasn't able to receive a satisfactory answer so I'll try again.

    I would like to know how to iterate though the underlying dataset in the same order as the sort-order specified in the datagrid.

    Regards,

    Anthony

    Filed under: ,
  •  08-06-2009, 3:46 PM Post no. 23207 in reply to 23197

    Re: DataGrid Sort Order

    Hi Anthony,

    You can get the visual order by using the Items collection on your DataGridControl. You can also use it's GetItemAt() method to retrieve a specific item (index starts at 0).

    For example:

       ItemCollection items = this.myGrid.Items;
       foreach( Employee item in items )
       {
          Console.WriteLine( "{0}", item.FirstName );
       }

       Console.WriteLine( "1st: {0}", ( ( Employee )this.myGrid.Items.GetItemAt( 0 ) ).FirstName );
       Console.WriteLine( "2nd: {0}", ( ( Employee )this.myGrid.Items.GetItemAt( 1 ) ).FirstName );

     


    Diane Lafontaine
    Technical Support / Technical Support Team Lead
    Xceed Software Inc.
  •  08-07-2009, 9:24 AM Post no. 23220 in reply to 23207

    Re: DataGrid Sort Order

    Hi Diane,

    Thank you very much, this worked for me.

    Regards,

    Anthony

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.