Hi, I am just wondering if I can write text into a non string cell, like a DateTime type cell. Though sounds confusing. This is what I want to happen. On a DateTime property, a user can correctly input dates. However, we have a constant start date (01/01/0001) + End Date (31/12/9999) But instead of a user inputting these dates, I want them to input the word "min" (for 01/01/0001) and "max" (for 31/12/9999)It just makes more sense to a user. Is there any functionality of the WinGrid that can do this?CheersChris
Hi Chris,
This may be possible, but it's tricky. There's no simple way to do it, if that's what you're looking for.
By default, the grid will use a DateTimeEditor for a DateTime cell and this editor has a mask which won't allow the user to type in letters. So you'd have to change the editor to something that allows text, like an UltraTextEditor. But this means you will lose the DateTimePicker in the dropdown. You could create your own using editor buttons, but it's no small task.
Another option would be to try to use UltraCalendarCombo. This editor allows you to enter text and has a dropdown, so it's probably a better choice. But then you have the challenge of converting the entered text into a date before the editor tries to validate it. I think this might be possible using a DataFilter.
I assume that once the user enters (min) and leaves the cell, you want the cell to show the actual date and not show "min" any more. Is that right? Or do you intend to maintain the textual display of what they entered? If the latter, then does it matter if the user enters "01/01/0001" and the cell changes it to "min?"
Hi Mike, Well, I would like the user to put "Min" which the WinGrid will display continuously, but obviously not lose the Datepicker on the cell. But your way would work just as nicely, so if they put "min" it can then be changed on cell or row update to 00/01/0001. Or a user could put 01/01/0001 then the cell changes to "min"So all ways are possible. I have tried looking at the DataFilter so..
case ConversionDirection.OwnerToEditor: args.Handled = true; if ((DateTime)args.Value == DateTime.MinValue.Date) return "MIN"; else return args.Value; But I am guessing if returning "MIN" I will lose the date picker from the cell?I guess the only options available is to lose the DatePicker functionality or build/ use a control (like UltraCalendarCombo)?CheersChris