I have an UltraGrid bound to an UltraDataSource. One of the fields (DateOfBirth) is a date field. When the user clicks the "down" arrow to the right of the date (to pop up the calendar), it always defaults to 1/1/2001 (rather than the date in the cell) and then changes the date in the cell to 1/1/2001 once it has "popped up".
How do I get the UltraGrid to show the correct date (on the pop-up calendar) based on what is in the cell? For example, if the date in the cell is "5/1/1952", that's the date I want to show up when the user pops up the calendar -- not 1/1/2001.
Bfore-and-after screens shots are included.
If simply clicking the dropdown arrow is changing the date in the cell, then something is wrong. This is obviously not the intended behavior. I've never heard of that happening before. My best guess is that the field is not actually using the DateTime data type. Or perhaps something in your code is changing the value inadvertently.
If that does not help, then I'm not sure what else it could be. Can you post a small sample project demonstrating the issue? If so, I'd be happy to take a look.
Hi Mike:
Here is the test project. I checked to make sure that the fields are dates (which they are). If you MANUALLY enter dates into the column, then the dropdown calendar works fine. But if the data is read in from a DataSource, then it always reverts back to 1/1/2001. I have confirmed this on two separate projects.
Can you check and see what I am doing wrong? I put "EXIT SUB' statements in all my UltraGrid events just to make sure that my code wasn't causing this (which doesn't seem to be the case).
Kevin
Hi Kevin,
I have tested the sample that you sent to DS. When there is no value in the cell and you click the drop down the date that is displayed is today's date and that is correct. I am also sending you a movie capture as an update to the DS case.
Please advice on how to reproduce the issue.
Magued
The following update was done by Magued from Infragistics. I apologize for the error.
Magued:
The problem is not on a blank cell. That works FINE. The problem is when the cell has a current date value. Go to a cell that has a date value that was populated by the UltraDataSource (NOT one you entered manually). Click on the arrow to show the calendar. It will default to 1//1/2001 and wipe out the current cell's value.
I just ran your sample. The very first row in the grid has a Date Of Birth of "12/07/1960". If I understand you correctly, you are saying that when you click the dropdown arrow in this cell, the dropdown shows 1/1/2001 instead of the date in the cell.
But this is not the behavior I get. When I run this sample and dropdown the calendar, I get 12/07/1960 selected on the dropdown, just as I should.
Am I misunderstanding what you are describing? Or are you just getting different behavior?
If the latter, then I recommend that you download and install the latest service release, because it looks like this may be a bug that has already been fixed.
The only other explanation I can think of is that perhaps this is related to some system setting. Perhaps your system date settings are set up in an unusual way - or at least different from mine.
Hi Mike,
With this hotfix my problem was solved too. Thanks!
Calin
I just downloaded build 2068 version of NetAdvantage 2008 V3 and now it is working perfectly. Evidently there is something weird going on in the NetAdvantage 2008 V3 build 2059 that is causing this discrepancy.
I also downloaded the latest hotfix for NetAdvantage 2009 V1 (build 2013) and it works fine in that build, too.
Thanks again,
I have a similar problem with Kevin. My system regional settings are not English. May be this cause the problem. And if I set the thread current culture like that:
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ro-RO", true);
when I press 'down arrow' to pop up the calendar I get:
System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) at System.Convert.ToDateTime(String value, IFormatProvider provider) at Infragistics.Win.UltraWinMaskedEdit.EditInfo.MaxValueForMask(Object maxValue, String mask) at Infragistics.Win.UltraWinMaskedEdit.EditInfo.CalculateTrueMaxValue() at Infragistics.Win.MonthDropDown.DoDropDown(EmbeddableUIElementBase element) at Infragistics.Win.DateTimeEditor.DoDropDown() at Infragistics.Win.EmbeddableEditorBase.DropDown() at Infragistics.Win.DateTimeEditorDropDownButtonUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnMouseDown(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
even the cell has a valid date or is empty.
As I said, this is not the behavior I am getting. It works fine for me. So either I have a newer version than you - in which case you should get the latest service release (you can download it here: My Infragistics Keys and Downloads - Download Anything and Everything You Own)
Or, this is related to some system setting.
I suspect the former.
Mike:
Ignore my prior comment (regarding the UltraDataSource). If I put a date before 1/1/2001, then it reverts back to 1/1/2001. If the UltraDataSource populates a date prior to 1/1/2001, then it puts 1/1/2001 in. Any date after 1/1/2001 works fine. I don't have any properties set that would force a minimum date of 1/1/2001.
Hope that helps.