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

griddataboundgrid sort

Thread ID:

Created:

Updated:

Platform:

Replies:

94222 Apr 29,2010 08:45 PM UTC May 15,2010 10:38 AM UTC WinForms 2
loading
Tags: GridControl
Santosh Kandhukuri
Asked On April 29, 2010 08:45 PM UTC

When i click on a column the griddataboundgrid should sort by that particular column.

Santosh Kandhukuri
Replied On April 29, 2010 09:57 PM UTC

I tried this example
http://www.syncfusion.com/support/kb/784/How-can-I-restrict-the-sorting-of-the-particular-column-on-Header-click-

This example didnt work for me. I am unable to double click the header at all.



Christopher Issac Sunder K [Syncfusion]
Replied On May 15, 2010 10:38 AM UTC

Hi Santosh,

We appreciate your interest in Syncfusion products.

You can try the given sample which illustrates the CellClick event as well as CellDoubleClick event in GridDataBoundGrid Sorting. You can also make use of manual sorting instead of setting the gridDataBoundGrid1.SortBehavior by handling the DataTable directly through DataView with the following code.

void gridDataBoundGrid1_CellClick(object sender, GridCellClickEventArgs e)
{
if ((e.ColIndex == 1 || e.ColIndex == 3)
&& e.RowIndex == 0)
{
int filed = this.gridDataBoundGrid1.Binder.ColIndexToField(e.ColIndex);
string name = this.gridDataBoundGrid1.Binder.InternalColumns[filed].MappingName;
string sort = myDataTable.DefaultView.Sort.Contains(name) ? (myDataTable.DefaultView.Sort.Contains("ASC") ? "DESC" : "") : "ASC";
if (sort.Length > 0)
myDataTable.DefaultView.Sort = "[" + name + "] " + sort;
else
myDataTable.DefaultView.Sort = String.Empty;
e.Cancel = true;
this.gridDataBoundGrid1.Refresh();
}
}


Suppose, If you need to sort the Column with double click, you can make a try with the following code snippet.

this.gridDataBoundGrid1.SortBehavior = GridSortBehavior.DoubleClick;

And to capture the double click on the cell, you can use the CurrentCellControlDoubleClick event instead of CellDoubleClick event.

Please refer the following sample link which illustrates the behavior of CellClick, CellDoubleClick and CurrentCellControlDoubleClick in GridDataBoundGrid.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDBG-662623379.zip

Let me know if you have any further concerns.

Regards,
Christopher K.

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

;