AD
Administrator
Syncfusion Team
April 2, 2004 06:33 AM UTC
In order for the GridDataBoundGrid to handle sorting, the datasource must implement IBindingList and supporting through its sorting implementation methods. ArrayList does not implement IBindingList.
To get the sort headers I think the simplest thing to do is to add a member to your class, sortedCol, that you set when you sort a column. Then handled the PrepareViewStyleInfo event, and if the cell is your sort header cell, set its properties there.
//add the member
private int sortedCol
//then after you complete your sort, insert code to set the
//member and redraw the header row so PrepareViewStyleInfo will be hit
this.sortedCol = e.ColIndex;
this.gridDataBoundGrid1.RefreshRange(GridRangeInfo.Row(0));
//the event handler
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if(e.RowIndex == 0 && e.ColIndex == sortedCol)
{
e.Style.CellType = "ColumnHeaderCell";
e.Style.Tag = ListSortDirection.Descending;
}
}