Hello,
I try to add a calendar control into UltraWinGrid cells who may contain some Nullable dates (Nullable(of Date) datatype) but the UltraWinGrid doesn't recognize the data in those cells as "Date" and the grid doesn't display the calendar as it should do by default for date datatype. So I've tried to add a UltraCalendarCombo he can't deal with Nullable datatype even if this control had a 'allowNull' property
I receive this error message : Editor provided by UltraCalendarCombo does not support the column's data type
Anyone know a control who may deal with Nullable dates (Nullable(of date)) and how to add it to an UltraWinGrid?
Thanks
It sounds to me like you are experiencing two bugs here.
First, the grid should detect Nullable(DateTime) and automatically use a dropdown calendar in the cell.
Second, the UltraCalendarCombo should be able to handle Nullable(DateTime) values.
Are you using the latest hot fix? If not, you should try it and see if these issues are already fixed. If that does not help, you should Submit an incident to Infragistics Developer Support
I'm not sure we use the latest hot fix. How can I see if it's installed (by the version number of the installed component?)
version used : 6.2.20062.34
One thing is sure, the grid detect Date datatype but he doesn't detect Nullable(Date) even Nullable(DateTime)
That is the original release version with no hot fix. You can find the hot fix versions listed here:
BLOGS: Vincent McDonald
And you can get the hot fixes for products you own here:
My Infragistics Keys and Downloads - Download Anything and Everything You Own
After many hours of searchs and tests, We have found the solution. It's not a problem of version or hot fix, it's just a question of cell style.
When you set a cell to a nullable(of Date) or Nullable(of DateTime), you must set the style of the cell to force the grid to display the the calendar dropdown and format the content as a Date.
Here is the code to handle a Nullable Data datatype
e.Layout.Bands(1).Columns("column").Style = ColumnStyle.Date ' Set the style of the cell
e.Layout.Bands(1).Columns("column").NullText = "-" ' Display something when the date is set to Nothing
I was having a similar problem and I am using the suggestion found here in this post. However I am having a strange problem when trying to type in dates to this column using the keyboard. My situation is this:
1) My grid column is bound to a datatype of Nullable(of Datetime).
2) The style of the column is set to Date (to force the calendar control to appear).
3) When using the keyboard to enter a date it only lets me use 1 digit for the year. For example, lets say I am entering the date "1/1/08". I enter a "1" then a "/" then a "1" then a "/" and then a "0" (because I want to type the year 08). The first character I type for the year (in this case a 0) becomes the complete year (2000) and then the cell goes out of edit mode and the row is committed to the database. In other words, it is impossible for me to use the year 2010, because as soon as I try to type the year and I type in a 2 (for example), the control immediately fills in with the year 2002, if I type in a 1 (to try and type in 10) it immediately fills in with the year 2001. Is anyone having a similar problem?
I've written a small test project to try to reproduce your problem but for me, everything works fine.
I've just written those lines in the grid "InitializeLayout" method:
' My object contain a column of type "Nullable (Of date)"
e.Layout.Bands(0).Columns("ADate").Nullable = Infragistics.Win.UltraWinGrid.Nullable.Nothing
e.Layout.Bands(0).Columns("ADate").Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Date
The only difference with your application it's my regional settings. I write a date in this format : YYYY-MM-DD. I'm able to write a date like 2001-01-25 just by typing 1-1-25 but I'm able to type 99-01-01 (give me the date 1998-01-01).
I've join as attachment my test project (zip file). Hope this can help you.
FredTremSNC,
As you can see from my post above, my problem was self-inflicted because I had some code in the cell change event.
However, I want to thank you again for responding, and most of all for posting your final solution for the null dates in the grid problem. I have struggled with this for years and finally your solution fills every need and solves every problem I had!
Thank you again!