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.

How to programatically obtain the Column name and Order of Sorting no matter on clicking the GridGroupingControl Columns?

 

To obtain the column name and order of sorting by clicking the column name when the GridControl is grouped by any of the column, the SortedItemsInGroup event can be used to obtain this. Please refer the below code snippet which illustrates this:

C#

this.GridGroupingControl1.SortedItemsInGroup += new GroupEventHandler(GridGroupingControl1_SortedItemsInGroup);

void GridGroupingControl1_SortedItemsInGroup(object sender, GroupEventArgs e)

{

SortColumnDescriptorCollection collection = e.Group.Details.ParentTableDescriptor.SortedColumns;

foreach (SortColumnDescriptor sort in collection)

{

//Get the name of Sorted Columns

this.TextBox1.Text +=" " + sort.GetName();

//Get the Direction

this.TextBox1.Text += " " + sort.SortDirection;

}

}

VB

AddHandler GridGroupingControl1.SortedItemsInGroup, AddressOf GridGroupingControl1_SortedItemsInGroup

Private Sub GridGroupingControl1_SortedItemsInGroup(ByVal sender As Object, ByVal e As GroupEventArgs)

Dim collection As SortColumnDescriptorCollection = e.Group.Details.ParentTableDescriptor.SortedColumns

For Each sort As SortColumnDescriptor In collection

'Get the name of Sorted Columns

Me.TextBox1.Text &= " " & sort.GetName()

'Get the Direction

Me.TextBox1.Text &= " " & sort.SortDirection

Next sort

End Sub

Sample:

http://help.syncfusion.com/support/samples/kb/Grid.Web/6.1.0.34/GGCSortGroup/SortGroup.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
739 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

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.