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

Formating GroupCaptionCell

Thread ID:

Created:

Updated:

Platform:

Replies:

74569 Jun 19,2008 05:00 PM UTC Jul 4,2008 06:18 AM UTC WinForms 6
loading
Tags: Grouping
Abhishek Shivalingaiah
Asked On June 19, 2008 05:00 PM UTC

Syncfusion 6.1
VS 2005

I'm grouping by 3 columns, one is a string, another a date and another a number. I want to format the groupcaptioncells based on the type of data being displayed. For instance I want the date in the groupcaptioncell to be displayed in a certain format, same with number. Can this be done without using the QuerycellStyleInfo event and checking the value?


Jisha Joy [Syncfusion]
Replied On June 20, 2008 07:35 AM UTC

Hi Shek,

This can be achieved by using GroupByOptions.CaptionText property. Please refer the code:


gridGroupingControl1.TableDescriptor.Columns["StringColumn"].GroupByOptions.CaptionText = "MyName";



Please try this and let me know if this helps.

Regards,
Jisha


Abhishek Shivalingaiah
Replied On June 24, 2008 07:34 PM UTC

Jisha...I'm not sure I understand the soltuion you proposed. I'm trying to set the formatting on the groupcaptioncells, not the caption text.

Thanks

>Hi Shek,

This can be achieved by using GroupByOptions.CaptionText property. Please refer the code:


gridGroupingControl1.TableDescriptor.Columns["StringColumn"].GroupByOptions.CaptionText = "MyName";



Please try this and let me know if this helps.

Regards,
Jisha




Jisha Joy [Syncfusion]
Replied On June 25, 2008 11:27 AM UTC

Hi Shek,

Thank you for your update.

You can use Format property of GroupByAppearance.GroupCaptionCell to format the GroupCaptionCell.

Please refer the code:



this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByOptions.CaptionText = "{Category}";
this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByAppearance.GroupCaptionCell.Format = "MMM";
this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByAppearance.GroupCaptionCell.CellValueType = typeof(System.DateTime);




Regards,
Jisha


Abhishek Shivalingaiah
Replied On June 27, 2008 01:51 PM UTC

Jisha..thanks for the response. I used the code piece you suggested, but still can't seem to format the date values in the groupcaptioncell. Attached is a sample.
Thanks



>Hi Shek,

Thank you for your update.

You can use Format property of GroupByAppearance.GroupCaptionCell to format the GroupCaptionCell.

Please refer the code:



this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByOptions.CaptionText = "{Category}";
this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByAppearance.GroupCaptionCell.Format = "MMM";
this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByAppearance.GroupCaptionCell.CellValueType = typeof(System.DateTime);




Regards,
Jisha





DateGridGroupingTest_704d8739.zip

Abhishek Shivalingaiah
Replied On July 2, 2008 11:01 PM UTC

Any word on this? Appreciate a response. Thanks

>Jisha..thanks for the response. I used the code piece you suggested, but still can't seem to format the date values in the groupcaptioncell. Attached is a sample.
Thanks



>Hi Shek,

Thank you for your update.

You can use Format property of GroupByAppearance.GroupCaptionCell to format the GroupCaptionCell.

Please refer the code:



this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByOptions.CaptionText = "{Category}";
this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByAppearance.GroupCaptionCell.Format = "MMM";
this.gridGroupingControl1.TableDescriptor.Columns["Col3"].GroupByAppearance.GroupCaptionCell.CellValueType = typeof(System.DateTime);




Regards,
Jisha





DateGridGroupingTest_704d8739.zip


Jisha Joy [Syncfusion]
Replied On July 4, 2008 06:18 AM UTC

Hi Shek,


Sorry for the delay in getting back to the issue.


You can handle the QueryCellStyleInfo event to solve this. See the below code snippet for more details.



// In form load
this.gridGroupingControl1.TableDescriptor.Columns["Criteria Value"].GroupByOptions.CaptionText = "{Category}";


this.gridGroupingControl1.QueryCellStyleInfo += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);


void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
{
GridCaptionRow gcr = e.TableCellIdentity.DisplayElement as GridCaptionRow;


if (gcr.ParentGroup != null && gcr.ParentGroup.Category != null && gcr.ParentGroup.Name == "Criteria Value")
{
e.Style.CellValueType = typeof(System.DateTime);
e.Style.Format = "dd MM yyyy";
e.Style.Text = string.Format("{0}", e.Style.CellValue);
}
}
}



Regards,
Jisha


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

;