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.

Regarding column header click sort

Thread ID:

Created:

Updated:

Platform:

Replies:

72168 Mar 6,2008 12:20 AM Mar 13,2008 07:24 AM Windows Forms 1
loading
Tags: Grouping
k.sathishkumar
Asked On March 6, 2008 12:20 AM

Hi All,

I am using GridGroupingControl, while click on grid Column header it's sorting properly and showing on the UI but problem is after sort in UI, In the datasource BindingList doesn't contain sorted list it contain old list only(which was assigned initailly before sort in UI. So it means that sort in column header click doesn't sort in underlying datasource.

Can you give please tell me how do i update underlaying datasource while sorting in UI?

Waiting for your reply...

Thanks and Regards
K.Sathishkumar


Administrator [Syncfusion]
Replied On March 13, 2008 07:24 AM

Hi Sathishkumar,

Thank you for your interest in Syncfusion products.

To sort the underlaying datasource while sorting in UI to handle TableControlQueryAllowSortColumn and set the ApplySort method.
Please refer the code below for more details.

void TableControl_QueryAllowSortColumn(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowSortColumnEventArgs e)
{
CurrencyManager lm = this.BindingContext[this.gridGroupingControl1.DataSource] as CurrencyManager;
ListSortDirection direction=((IBindingList)lm.List).SortDirection;
if (direction == ListSortDirection.Ascending)
direction = ListSortDirection.Descending;
else
direction = ListSortDirection.Ascending;

if (lm.List is IBindingList && ((IBindingList)lm.List).SupportsSorting)
{
PropertyDescriptorCollection pdc = lm.GetItemProperties();
((IBindingList)lm.List).ApplySort(pdc[0], direction);
}
Console.WriteLine(((IBindingList)lm.List).SortDirection.ToString());
}


Please refer the attached sample for more details.

http://websamples.syncfusion.com/samples/Grid.Windows/I41988/main.htm

Best Regards,
Asem.



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.

;