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.

How to sort a GridDataBoundGrid on multiple columns

Thread ID:

Created:

Updated:

Platform:

Replies:

40814 Feb 14,2006 04:52 AM Dec 4,2006 06:23 AM Windows Forms 6
loading
Tags: GridControl
e.davidse
Asked On February 14, 2006 04:52 AM

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

stanleyj [Syncfusion]
Replied On February 14, 2006 06:53 AM

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

Administrator [Syncfusion]
Replied On March 20, 2006 04:17 PM

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

Administrator [Syncfusion]
Replied On March 20, 2006 11:12 PM

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.

Administrator [Syncfusion]
Replied On December 1, 2006 05:16 PM

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;
}

Administrator [Syncfusion]
Replied On December 1, 2006 07:01 PM

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?

Administrator [Syncfusion]
Replied On December 4, 2006 06:23 AM

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

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.

;