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.
Syncfusion Feedback

sorting in hierarchy level 1

Thread ID:

Created:

Updated:

Platform:

Replies:

52633 Dec 1,2006 08:23 AM UTC Dec 1,2006 08:40 AM UTC Windows Forms 1
loading
Tags: GridControl
mark xie
Asked On December 1, 2006 08:23 AM UTC

Hi,

I am using databoundgrid and i have two hierarchy level (0 and 1), how do i sort data by a column in hierarchy level 1 ( the second hierarchy level)?

mark

Administrator [Syncfusion]
Replied On December 1, 2006 08:40 AM UTC

Hi Mark,

Here is some code snippet that sorts the child table records programatically:

DataView dv;
bool True;

private void buttonAdv1_Click(object sender, System.EventArgs e)
{
GridBoundRecordState rs;
int pos = this.gridDataBoundGrid1.Model.RowCount;
for(int i = 0; i {
rs = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(i);
True = rs.HasChildList;
// Check whether there are child records
if(True)
{
dv = rs.ChildList as DataView;
if(dv != null)
{
// Sort
dv.Sort = "ProductName DESC";
this.gridDataBoundGrid1.RefreshRange(GridRangeInfo.Rows(i + 1, i + rs.ChildCount));
i += rs.ChildCount;
}
}
}
}

Here is a sample.
ChildTableSorting.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.

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

;