ComponentOne FlexGrid for WinForms
SortColEventArgs Class
Members  Example 

C1.Win.C1FlexGrid Namespace : SortColEventArgs Class
Provides data for the C1FlexGridBase.BeforeSort and C1FlexGridBase.AfterSort events.
Syntax
'Declaration
 
Public Class SortColEventArgs 
   Inherits System.EventArgs
public class SortColEventArgs : System.EventArgs 
Remarks
Example
private void Form1_Load(object sender, EventArgs e)
{
            _flex = new C1FlexGrid();
            _flex.Dock = DockStyle.Fill;
            this.Controls.Add(_flex);

            OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\ComponentOne Samples\\Common\\C1NWind.mdb");

            DataSet ds = new DataSet();
            new OleDbDataAdapter("Select * from Orders", con).Fill(ds,"Orders");
            new OleDbDataAdapter("Select * from Employees", con).Fill(ds, "Employees");
            _flex.DataSource = ds.Tables["Orders"];

            // create relation
            ds.Relations.Add("Order_Employee",ds.Tables["Employees"].Columns["EmployeeID"],ds.Tables["Orders"].Columns["EmployeeID"]);
            // add calculated columns (look up names based on IDs, for sorting)
            ds.Tables["Orders"].Columns.Add("EmployeeMapped",typeof(String), "Parent(Order_Employee).LastName + ' ' + Parent(Order_Employee).FirstName");
            // add data map
            MultiColumnDictionary multiColumnDictionary = new MultiColumnDictionary(ds.Tables["Employees"],"EmployeeID",new String[] { "LastName","FirstName"},0);
            _flex.Cols["EmployeeID"].DataMap = multiColumnDictionary;
            // hide the calculated columns
            _flex.Cols["EmployeeMapped"].Visible = false;

            _flex.BeforeSort += _flex_BeforeSort;
}

private void _flex_BeforeSort(object sender, SortColEventArgs e)
{
            // intercept sort command and sort by mapped column instead
            if (_flex.Cols[e.Col].Name == "EmployeeID")
            {
                int col = _flex.Cols["EmployeeMapped"].Index;
                _flex.Sort(e.Order, col);
                _flex.ShowSortAt(e.Order, col);
                e.Handled = true;
            }
}
Inheritance Hierarchy

System.Object
   System.EventArgs
      C1.Win.C1FlexGrid.SortColEventArgs

See Also

Reference

SortColEventArgs Members
C1.Win.C1FlexGrid Namespace