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.
Syncfusion Feedback

Time in MonthCalendar cell in GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

67753 Aug 29,2007 03:10 PM UTC Aug 31,2007 12:38 AM UTC Windows Forms 2
loading
Tags: GridControl
Chris
Asked On August 29, 2007 03:10 PM UTC

I've got a GridDataBoundGrid I'm populating with date and time information from a database query. The query returns date and time information, and the datatable contains the time as well, but when I display it in a MonthCalendar formatted cell the time is stripped. How do I tell the cell to include the time?

I don't want to explicitly set a format string since it seems that would screw with localization settings. I want the date and time format to be provided by the OS.

C

Chris
Replied On August 30, 2007 05:27 PM UTC

Does anyone have any advice on this? It seems like a fairly simple problem but I can't figure out the best way to solve it.

I need to tell the cell to include the time information, but I don't want to explicitly tell it what date/time format to use because that would throw localization out the window.

On a side note, the datetime pickers I'm deeing only seem to be 'date' pickers. None of them have a time selector built in. Am I looking at the wrong cell types?

>I've got a GridDataBoundGrid I'm populating with date and time information from a database query. The query returns date and time information, and the datatable contains the time as well, but when I display it in a MonthCalendar formatted cell the time is stripped. How do I tell the cell to include the time?

I don't want to explicitly set a format string since it seems that would screw with localization settings. I want the date and time format to be provided by the OS.

C

J.Nagarajan [Syncfusion]
Replied On August 31, 2007 12:38 AM UTC

Hi Chris,

Thanks for your interest in Syncfusion product.

To show the required date and time format in GridDataBoundGrid, you can use GridDropDownMonthCalendarCellRenderer class and set the StyleInfo Format property to DateTimeFormat.FullDateTimePattern. Please refer to the following code snippet

this.gridDataBoundGrid2.Binder.InternalColumns[0].StyleInfo.Format = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.FullDateTimePattern;

GridDropDownMonthCalendarCellRenderer cr = this.gridDataBoundGrid2.CellRenderers["MonthCalendar"] as GridDropDownMonthCalendarCellRenderer;
if (cr != null)
{
MonthCalendar cal = null;
foreach (Control c in cr.DropDownContainer.Controls)
{
if (c is MonthCalendar)
{
cal = c as MonthCalendar;
break;
}
}

}

Here, I have attached the sample that demonstrates the intend behavior. You can download the sample from the following page

http://websamples.syncfusion.com/samples/Grid.Windows/F67753/main.htm

Please refer to the sample and let me know if you have any questions.

Regards,
Nagaraj

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

;