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 format a DateTime as text with no dropdown in a GGC (GridGroupingControl)

Thread ID:

Created:

Updated:

Platform:

Replies:

91338 Nov 13,2009 01:28 AM Nov 13,2009 07:06 AM ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On November 13, 2009 01:28 AM

We have a requirement for a column in a GridGroupingControl to display a full date time in full format "dd/MM/yyyy h:mm:ss tt". Note that this is a read-only grid so we don't need users to be able to edit anything.

By default GGC columns bound to a DateTime display as "dd/MM/yyyy" and have a drop down that displays a date picker control. I've been able to disable the date picker control, and when you actually select a cell it displays as "dd/MM/yyyy h:mm:ss tt", but cells that are not selected are shown in "dd/MM/yyyy" format.

I've tried changing heaps of different properties and googling but can't find the solution. What property or properties need to be set to display full date and time in DateTime columns, rather than just dates?

Gowri Manohari D [Syncfusion]
Replied On November 13, 2009 07:06 AM

Hi Ben,

Thank you for choosing Syncfusion Products.

We have created sample for your requirement. The sample which i have created will display the "DateTime" column with "dd/mm/yyyy h:mm:ss tt" format. All the formatting will be done in GridGroupingControl1_QueryStyleInfo event. Please refer the code snippet for more details

void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
if(e.TableCellIdentity.Column.Name == "Birthdate" )
{
e.Style.Format = "dd/MM/yyyy h:mm:ss tt";
}
e.Handled = true;
}
}

Please find the sample from below link

http://files.syncfusion.com/support/GGC.Web/7.3.0.20/F91338/main.htm

Let me know if you have any other queries.

Regards,
Gowri

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.

;