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. Image for the cookie policy date

Grid Grouping Caption Text

Hi,

I am using a GGC, in it i am grouping by a date.When i am grouping by date i want to show the display date in different format

i have added below code

gridColumnDescriptor = grdMeetInvHistory.TableDescriptor.Columns.FindByMappingName(CalendarModelUpdater.MeetingResultDateColumnName);

gridColumnDescriptor.TableDescriptor.GroupedColumns.Add(MeetingResultDateColumnName);
grdMeetInvHistory.ChildGroupOptions.CaptionText = "{Category}";
gridColumnDescriptor.Appearance.GroupCaptionCell.Format = "dddd dd MMMM yyyy";


but it is not working
is there any way to show the date in different format

Thanks & Regards
Ajay

2 Replies

AD Administrator Syncfusion Team September 1, 2006 06:58 AM UTC

Hi Ajay,

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

//form load event.
this.gridGroupingControl1.TableDescriptor.GroupedColumns.Add("MeetingResultDateColumnName" ,ListSortDirection.Ascending);
this.gridGroupingControl1.TableDescriptor.Columns["MeetingResultDateColumnName"].GroupByOptions.CaptionText = "{Category}";

//QueryCellStyleInfo
if(e.TableCellIdentity.TableCellType==GridTableCellType.GroupCaptionCell)
{
GridCaptionRow gcr = e.TableCellIdentity.DisplayElement as GridCaptionRow;
//get value of first group

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

Thanks,
Haneef


AB Ajay Bhalegar September 1, 2006 04:50 PM UTC

Hi Hanif,

Thanks a lot, the code given by you is working fine.

Thanks & Regards
Ajay

Loader.
Live Chat Icon For mobile
Up arrow icon