How to sort a GridDataBoundGrid on multiple columns

Hi there, Is it posible to sort the GridDataBoundGrid on multiple columns? The idea is that when the user double clicks with the for example control key down that the selected column is added to the sort createria. It would be wonderfull if we than also could change the icon of the second sort header to a triangle with a two next to it. Regards, Erwin Davidse

6 Replies

ST stanleyj Syncfusion Team February 14, 2006 11:53 AM UTC

Hi Erwin, This article deals with multiple columns sorting in a GridDataBoundGrid, please refer the link below. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=110 Best regards, Stanley


AD Administrator Syncfusion Team March 20, 2006 09:17 PM UTC

Hello There, Does this article also apply to GridGroupingControl with multiple columns sorting? Lan >Hi Erwin, > >This article deals with multiple columns sorting in a GridDataBoundGrid, please refer the link below. > >http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=110 > >Best regards, >Stanley


AD Administrator Syncfusion Team March 21, 2006 04:12 AM UTC

Hi Lan, The GridGroupingControl has built-in support for multi-column sorting. Please refer to this broswer sample ( \\Windows\Grid.Windows\samples\Grouping\GroupCustomers ). In the menu – Sorting – you can add the columns. Also please refer to this sample: MultiColumnSorting_GGC Let us know if this helps. Best regards, Madhan.


AD Administrator Syncfusion Team December 1, 2006 10:16 PM UTC

In the GridDataBoundGrid sample it throws an exception if a column is of type int and compares it to a DBNull.

It is easy to reproduce by adding....


private DataTable CreateDataTable()
{
string[] numberStrings = new string[]{"zero","one","two","three","four","five","six","seven","eight","nine"};

DataTable dt = new DataTable("table");
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("I", typeof(int));
dt.Columns.Add("S", typeof(string));
dt.Columns.Add("D", typeof(DateTime));

Random r = new Random();
for(int i = 0; i < 30; ++i)
{
int j = r.Next(10);
DataRow dr = dt.NewRow();
dr["ID"] = i;
if (j % 2 == 0)
dr["I"] = j;
else
dr["I"] = System.DBNull.Value;
dr["S"] = numberStrings[j];
dr["D"] = DateTime.Now.AddDays(10-r.Next(20)).Date;
dt.Rows.Add(dr);
}

return dt;
}


AD Administrator Syncfusion Team December 2, 2006 12:01 AM UTC

Using the above sample

this.gridbounddatagrid1.SortColumn(1);

doesn't do anything...

Firstly, what does SortColumn do.. ie does it call dataview.sort(1)?

Secondly, how can I fix the above example so that SortColumn still works as it did prior to adding the wrapper?


AD Administrator Syncfusion Team December 4, 2006 11:23 AM UTC

Hi Mike,

We were not able to reproduce the issue here. Is it possible for you to upload us a sample or modify the attached sample to reproduce the issue here? This will help us to analyse the issue further.

Sample : MultiColumnSort_GDBG_GGC_CS.zip

Best Regards,
Haneef

Loader.
Up arrow icon