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
close icon

DateCellQueryInfo event in GGC?

Hi,

I was wondering if it's possible to trap the DateCellQueryInfo event from a GridGroupingControl? I have a couple of columns that are of the MonthCalendar type, and I'd like to trap this event so that I can remove all dates prior to the current date from the calendar. For a regular MonthCalendarAdv control I have something like:

private void Calendar_DateCellQueryInfo(object sender, DateCellQueryInfoEventArgs e) {

if (dt < ((MonthCalendarAdv)sender).MinValue || dt > ((MonthCalendarAdv)sender).MaxValue || dt.DayOfWeek == DayOfWeek.Saturday || dt.DayOfWeek == DayOfWeek.Sunday) {
e.Style.CellValue = null;
}

}

Can this also be done from the calendar dropdown in the GGC? If so, can you please post a code snippet showing how this is accomplished?

Thanks,
Michael

1 Reply

AD Administrator Syncfusion Team November 9, 2006 11:55 AM UTC

Hi Michael,

The Grid's MonthCalendar celltype implements the System.Windows.MonthCalender control in DropDownContainer of the cell. It doesn't implement the Syncfusion.Windows.Tools.MonthCalendarAdv control in a DropDownContainer of the cell. You can use the GridDropDownMonthCalendarCellRenderer to acess the MonthCalendar control in a cell. Here is a code snippet

GridDropDownMonthCalendarCellRenderer cr = this.gridGroupingControl1.TableControl.CellRenderers["MonthCalendar"] as GridDropDownMonthCalendarCellRenderer;
foreach(Control c in cr.DropDownContainer.Controls)
{
if( c is MonthCalendarAdv )
{
MonthCalendar cCalendar = c as MonthCalendar;
//you can use the any event from here....
//cCalendar.DateChanged....
}
}

If you want to implement the MonthCalendarAdv control in a cell, you need to create the custom celltypes. Please try the attached sample which implements the MonthCalendarAdv in a cell and let me know if you are looking something different.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/DateTimeCell_3cebccd9.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon