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

How to set CultureInfo for MonthCalendar cell type

Is it possible to set the CultureInfo for the MonthCalendar control cell type? When I set a grid cell's type to MonthCalendar, it ignored the custom CultureInfo value I set for the cell and seems to use the Windows regional settings instead.

3 Replies

HA haneefm Syncfusion Team July 17, 2007 03:59 PM UTC

Hi Don,

Is it possible to set the CultureInfo for the MonthCalendar control cell type?
>>>>>>>>
You can try these code:

this.grid[1,1].CellType = "MonthCalendar";
this.grid[1,1].CellValueType = typeof(DateTime);
this.grid[1,1].CultureInfo = new System.Globalization.CultureInfo("zh-HK");

Best regards,
Haneef


MS Maxim Software Systems July 17, 2007 06:55 PM UTC

That sort of worked. The date I select in the MonthCalendar now gets put into the cell in the proper format (dd/mm/yyyy as opposed to my Windows setting of mm/dd/yyyy), but I am now getting an "date format not recognized" error after that. It's as if the cell is validating the date that the calendar is returning, using a different CultureInfo to do it.



HA haneefm Syncfusion Team July 17, 2007 10:19 PM UTC

Hi Don,

The GridStyleInfo.Format property string used to format the text to display in the grid. you can specify the numeric format string, Date format string or enumeration format string by using this property. Below is a code snippet that set the "MM/dd/yyyy" format.

this.gridControl1[1, 1].Format = "MM/dd/yyyy";

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon