Reg: GridControl (Monthcalendar Property)

Hi, Please, go through my sample code. Problem: Example 1) Select Feb 10.(It showing correct MM/dd/yyyy) fromat. 2) Again try to click datetime picker. (it suppose to show feb sheet but it showing correspondong date(10) month (October).[2nd October] MonthCalendar_2092.zip Thanks, Anna

1 Reply

AD Administrator Syncfusion Team August 22, 2005 10:14 AM UTC

When I run your sample, I do not see a problem unless I change my regional setting so that the string 02/10/2005 will be interpreted as Oct 10. I assum ethis is the problem you are seeing too. If so, you can avoid it by handling the CurrentCellShowingDropDown event as below.
private void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.Renderer is GridDropDownMonthCalendarCellRenderer)
	{
		GridDropDownMonthCalendarCellRenderer cr = cc.Renderer as GridDropDownMonthCalendarCellRenderer;
		if(cc.Renderer.ControlValue != null && cc.Renderer.ControlValue != DBNull.Value)
		{
			DateTime dt = (DateTime) cc.Renderer.ControlValue;
			cc.Renderer.ControlText = dt.ToString("g");
		}
	}
}

Loader.
Up arrow icon