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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I change/reset the styles of sorted columns in a GridGrouping control?

 

This can be done by handling the "GridGroupingControl.TableDescriptor.SortedColumns.Changed" event.This event is fired for both sorting and unsorting the columns.

In SortedColumnsChanged event, you can get the SortedColumns name and the performed action(sorted/unsorted). then you can change the styles of sorted columns and reset the styles of the Unsortedcolumns styles to its original state based on some criteria.

The following code sample shows how to set a back color of a sorted column.

C#

private void gridgroupingcontrol1_sortedcolumnschanged(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)

{

string sortedcolumns;

SortColumnDescriptor scd = (SortColumnDescriptor)e.Item;

sortedcolumns = scd.Name;

switch (e.Action)

{

case ListPropertyChangedType.Add:

{

this.GridGroupingControl1.TableDescriptor.Columns.FindByMappingName(sortedcolumns).Appearance.AnyRecordFieldCell.BackColor = Color.FromArgb(237, 240, 246);

break;

}

case ListPropertyChangedType.Remove:

{

this.GridGroupingControl1.TableDescriptor.Columns.FindByMappingName(sortedcolumns).Appearance.AnyRecordFieldCell.ResetBackColor();

break;

}

}

}

VB

     Private Sub GridGroupingControl1_SortedColumnsChanged(ByVal sender As Object, ByVal e As Syncfusion.Collections.ListPropertyChangedEventArgs)

         Dim sortedcolumns As String

         Dim scd As SortColumnDescriptor = CType(e.Item, SortColumnDescriptor)

sortedcolumns = scd.Name

         Select Case e.Action

Case ListPropertyChangedType.Add

Me.GridGroupingControl1.TableDescriptor.Columns.FindByMappingName(sortedcolumns).Appearance.AnyRecordFieldCell.BackColor = Color.FromArgb(237, 240, 246)

Exit Select

Case ListPropertyChangedType.Add

Me.GridGroupingControl1.TableDescriptor.Columns.FindByMappingName(sortedcolumns).Appearance.AnyRecordFieldCell.ResetBackColor()

Exit Select

         End Select

End Sub

Sample:

http://websamples.syncfusion.com/samples/KB/Grid.Web/6.1.0.34/GGCSortedColumn/main.htm

Article ID: Published Date: Last Revised Date: Platform: Control:
709 04/30/2011 07/10/2014 ASP.NET Web Forms (Classic) GridGroupingControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon 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.Close Icon