Hi,
I am using UltraControlContainerEditor to solve my purpose to set MinDate and MaxDate for each cell depending on some Business Rule.
UltraControlContainerEditor ucce = new UltraControlContainerEditor(); X.DateTimePicker dtEditor1 = new X.DateTimePicker(); ucce.EditingControl = dtEditor1; ucce.EditingControlPropertyName = "Value"; X.DateTimePicker dtEditor2 = new X.DateTimePicker(); ucce.RenderingControl = dtEditor2; ucce.RenderingControlPropertyName = "Value"; dgDriveRouteRows.DisplayLayout.Bands[0].Columns["StartDate"].EditorComponent = ucce;
private void SetMinMaxRelationDates(UltraGridCell cell) {var cellEditor = (cell.EditorComponentResolved as Infragistics.Win.UltraWinEditors.UltraControlContainerEditor).EditingControl as X.DateTimePicker;
var cellRender = (cell.EditorComponentResolved as Infragistics.Win.UltraWinEditors.UltraControlContainerEditor).RenderingControl as X.DateTimePicker; DateTime minRelationDate = GetMinFSDSRelationDate(Id); if (minRelationDate != default(DateTime)) { cellEditor.MinDate = minRelationDate; cellRender.MinDate = minRelationDate; }
}
Above code is setting Mindate but still I can see all dates and select any date in my datepicker control. Can you please identify the issue and suggest some way?
Thanks,
Nishant Kainth
Hello Nishant,
Thank you for the provided code snipped. What I’ve noticed is that your editor was added on ColumnLevel and you try to change the editor settings based on cell level, which actually affects editor on column level. So what you could do in your case is to use different instance of your editor for each cells of your column, or you could use BeforeEnterEditmode event of UltraGrid in order to manage min and max date for your editor just before user start using them.
I’ve implemented this suggestion in a simple sample which you could run and evaluate, please see attached zip.
Please let me know if you have any further questions.
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue?
Thank you for using Infragistics Components.