Question

I have a column with a datetime picker in ultragrid. Now i have to set the minvalue and maxvalue for that datetime.

//Code

            UltraGridColumn.Header.Caption = "Start Date"
            UltraGridColumn.Header.ToolTipText = "Start Date"
            UltraGridColumn.Hidden = True
            UltraGridColumn.Style = ColumnStyle.DateTimeWithSpin

I tried like minvalue as today and max value as 1 year from today. But not working

//Code

UltraGridColumn.MinValue = New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)
 UltraGridColumn.MaxValue = New DateTime(DateTime.Now.Year + 1, DateTime.Now.Month,DateTime.Now.Day)
Was it helpful?

Solution

You can set the MinValue property on the column itself:

' Put min and max constraints on a date column.
dateColumn.MinValue = New DateTime(1990, 1, 1)
dateColumn.MaxValue = New DateTime(2010, 12, 31)

Link to MinValue documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top