Hi zrelli,
There is no built-in event for detecting sort changes in a DataBoundGrid. If you want to detect the sort changes in DataBoundGrid, you would have to derive the GridDataBound control and override the SortColumn Method to fire the event . Here is a code snippet to show this.
public class MyDataBoundGrid: GridDataBoundGrid
{
public delegate void SortDirectionChanging(object sender,EventArgs e);
public event SortDirectionChanging SortChanging;
public delegate void SortDirectionChanged(object sender,EventArgs e);
public event SortDirectionChanging SortChanged;
public MyDataBoundGrid():base(){}
public override void SortColumn(int colIndex)
{
OnSortChanging(this,EventArgs.Empty);
base.SortColumn (colIndex);
OnSortChanged(this,EventArgs.Empty);
}
protected void OnSortChanging(object sender,EventArgs e)
{
if( SortChanging != null)
SortChanging(sender,e);
}
protected void OnSortChanged(object sender,EventArgs e)
{
if( SortChanged != null)
SortChanged(sender,e);
}
}
Please refer to the attached sample for implementation.
GDBGSortChangeEvent.zipBest Regards,
Haneef