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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DateTime picker future date

Thread ID:

Created:

Updated:

Platform:

Replies:

59641 Apr 18,2007 09:14 PM UTC Apr 18,2007 09:51 PM UTC WinForms 1
loading
Tags: GridControl
Ken
Asked On April 18, 2007 09:14 PM UTC

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

haneefm [Syncfusion]
Replied On 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

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

;