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

DateTime picker future date

I have a grid with a datetime column. By default the column will have no default values and the cells empty. When a user click into the cell to dropdown the datepicker I want it to default to a future date, not today's date. Is there a way to do this. I tried using CurrentCellStartEditing and the grdData.CurrentCell.Renderer to get the control but it doesn't seem to work. Anyone have any ideas.

Thanks in advanced.
Ken

1 Reply

HA haneefm Syncfusion Team April 18, 2007 09:51 PM UTC

Hi Ken,

One way you can do this by hanlding the CurrentCellShowingDropDown event of the grid and change the TodayDate of the MonthCalendar control in a grid. Here is a code snippet.

private void gridDataBoundGrid1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid ;
GridDropDownMonthCalendarCellRenderer cr = grid.CurrentCell.Renderer as GridDropDownMonthCalendarCellRenderer;
if( cr != null )
{
foreach(Control c in cr.DropDownContainer.Controls )
{
if( c is MonthCalendar )
{
MonthCalendar calendar = c as MonthCalendar;
DateTime future = DateTime.Now.AddDays(1);
calendar.TodayDate = future;
break;
}
}
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon