We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Detect sort change

Thread ID:

Created:

Updated:

Platform:

Replies:

53904 Dec 22,2006 04:15 AM Dec 22,2006 07:03 AM Windows Forms 1
loading
Tags: GridControl
zrelli
Asked On December 22, 2006 04:15 AM

Hi,

I want to detect sort expression change in my grid.

there are event ?

thanks ?

Administrator [Syncfusion]
Replied On December 22, 2006 07:03 AM

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.zip

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;