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 group rows by default on initial load

Thread ID:

Created:

Updated:

Platform:

Replies:

68812 Oct 2,2007 07:15 AM Oct 4,2007 04:24 PM Windows Forms 3
loading
Tags: GridControl
Titus Cheung
Asked On October 2, 2007 07:15 AM

Hello,

Is there a way to set by default that whenever the Grid Group control loads rows of data from the dB, it'd automatically group them by a specific column?

For example an example here
http://websamples.syncfusion.com/docs/gridwin/ug/default.html
illustrates that user can drag and drop the column name into the GroupDropArea in order to group the rows by that column. But I want this to be done on initial page load without requiring the user to do this.

Thanks.

haneefm [Syncfusion]
Replied On October 2, 2007 01:41 PM

Hi Titus,

At Loadtime, you can programatically group the grid by adding the column to the TableDescriptor.GroupedColumns collection.

grid.TableDescriptor.GroupedColumns.Add("Col1"); //group by the column whose name is "Col1".

Best regards,
Haneef

Titus Cheung
Replied On October 4, 2007 10:10 AM

Hi,

Thanks for the info.
Now that it's grouping on initial load, how do I set it such that it'd display a unique group name? For example, I'm sorting by a contactType column. This column has values "consultant", "engineer", "accountant", etc.

I found the section of code that does this and currently it has:
this.gridGroupingControl1.ChildGroupOptions.CaptionText = "{CategoryCaption}: {Category} - {RecordCount} Items";

and I need to change it to something like...
this.gridGroupingControl1.ChildGroupOptions.CaptionText = "{cellData}: {Category} - {RecordCount} Items";

Thanks

haneefm [Syncfusion]
Replied On October 4, 2007 04:24 PM

Hi Titus,

How can i change text of grid caption?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
The Group CaptionText can be customized using the TableDescriptor.ChildGroupOptions.CaptionText property (gridGroupingGrid.TableDescriptor.ChildGroupOptions.CaptionText = "{CategoryName}: {Category}";).

If you want to append the celldata in a gridcaptioncell, then handle QueryCellStyleInfo event to have your own text, there check for the e.TableCellIdentity.TableCellType to be GroupCaptionCell and set the text. Kindly refer to the forum thread below for more details.

http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11530
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=34184

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.

;