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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how do I resort colums after databound grid refresh?

Thread ID:

Created:

Updated:

Platform:

Replies:

52382 Nov 28,2006 02:48 AM UTC Nov 28,2006 04:58 AM UTC WinForms 1
loading
Tags: GridControl
Patrick Rumery
Asked On November 28, 2006 02:48 AM UTC

I know the column and the listsortdirection before I refresh the data in the grid, but the column only sorts ascending even when I tag it like the code below.
If _SortType = 0 Then
Me.dgSales(0, _SortCol).Tag = ListSortDirection.Ascending
Else
Me.dgSales(0, _SortCol).Tag = ListSortDirection.Descending
End If
dgSales.SortColumn(_SortCol). I'm using
Public WithEvents dgSales As GridHierDataBoundGrid as my grid.

thanks

Administrator [Syncfusion]
Replied On November 28, 2006 04:58 AM UTC

Hi Prumery,

In DataBoundGrid, you can set these tag properties only through the Model.QueryCellInfo event handler. One way you can acheive this would be to set a flag in the your sort module and check this flag in order to enable the sorting icon for the header cell in the Model.QueryCellInfo.

//Or

You can use the DefaultView.Sort property of the underlying datasource in a grid to control the sort direction. Here is a code snippet to show this

DataTable dt = this.gridDataBoundGrid1.DataSource as DataTable;

//Ascending order.
//dt.DefaultView.Sort = "[ColumnName] ASC"; // or //dt.DefaultView.Sort = "[ColumnName]"

//descending order
//dt.DefaultView.Sort = "[ColumnName] DESC";

//Cancel the Sorting...
//dt.DefaultView.Sort = "";

this.gridDataBoundGrid1.Refresh();

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

;