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. Image for the cookie policy date
close icon

Handling the click event on column header

Hi All,
I want to customize the sorting of any column and override the existing sorting behaviour.
In sense ,I want to sort a particular column on my own property and not on the data that is displayed in the column whenever the user clicks on the column header.
Hence I require the event in which i can write the code.

Pls help with the sample code.Thanks in advance
Regards
Aditi

sample requirement.zip

1 Reply

AD Administrator Syncfusion Team March 13, 2007 07:44 PM UTC

Hi Aditi,

If you want to control the selected column sorting in a grid then handle the the TableControlQueryAllowSortColumn event. This was discussed in the below forum thread.

http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=44188

To get the event of double click on column header, you need to subscribe the TableControlCellDoubleClick event and detect the column header. Here is a code snippet.

private void gridGroupingControl1_TableControlCellDoubleClick(object sender, GridTableControlCellClickEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex ,e.Inner.ColIndex);
if( style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell )
{
Console.WriteLine("Double Click on column header");
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon