Hello.
I know that the MinValue and MaxValue can be set on a column level, but how do you set it on a cell level?
I've managed a workaround by setting those properties on the column in the "BeforeEnterEditMode" event, but I'm not sure that that's the best way (see code, below).
Is there a better way?
Thanks in advance,
Mike
ugIncludedItems.BeforeEnterEditMode
ugIncludedItems.ActiveCell.Column.MaxValue =
).Value)
ugIncludedItems.ActiveCell.Column.MinValue = 0
Sub
Hello,
If you are following this approach you are setting MinValue and MaxValue on the column level and not on the cell level.
So you probably have to remove the style of the column and set an editor with the appropriate settings on each cell in the IntializeRow event like :
Private Sub ultraGrid1_InitializeRow(sender As Object, e As InitializeRowEventArgs) Dim unE As New UltraNumericEditor() e.Row.Cells("DesiredColumn").EditorComponent = unE unE.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.OnMouseEnter unE.MaxValue = e.Row.Cells("MaxValueColumn").ValueEnd Sub
Please let me know if you have any further questions.
I was able to get this working in our scenario using the approach of setting values on an editor for each cell in the InitializeRow event.
In our scenario we had a date where we'd want to let people pick the next date if the time was within 1 hour of midnight. Inside our InitializeRow event, I put code like this:
var rowObject = e.Row.ListObject as OurModelType; if (rowObject == null) return; var dateColumn = e.Row.Cells["EventDate"]; if (rowObject.EventTime.Hour >= 23) { dateColumn.Activation = Activation.AllowEdit; dateColumn.EditorComponent = new UltraDateTimeEditor { MinDate = rowObject.EventDate, MaxDate = rowObject.EventDate.AddDays(1) }; } else { dateColumn.Activation = Activation.NoEdit; }