Hi, I'm forcing ExitEditMode in either the ValueChanged or AfterCloseUp in order to get the current data when it's immediately available. Otherwise you have to tab out or click out to get the AfterExitEditMode to fire.
A posting here led me to be able to use:
if (((UltraDateTimeEditor)sender).IsInEditMode) ((UltraDateTimeEditor)sender).Editor.ExitEditMode(true, true);
and this works, but... if you select the drop down menu's "Today" link/button it will usually throw this exception:
System.ArgumentException: Can't access the 'IsValid' property when not in edit mode at Infragistics.Win.EditorWithMask.IsValidValue(String& errorMessage) at Infragistics.Win.EditorWithMask.get_IsValid() at Infragistics.Win.MonthDropDown.OnDateSelected(DateRangeEventArgs drevent) at System.Windows.Forms.MonthCalendar.WmDateSelected(Message& m) at System.Windows.Forms.MonthCalendar.WmReflectCommand(Message& m) at System.Windows.Forms.MonthCalendar.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Any way to trap this? or get around it? Thanks.
Hello Ihardtke,
I was able to reproduce the issue by first selecting a random date and then selecting "Today".
You can trap the first selection by placing a counter around your condition to prevent the exception from occuring like so:
int counter = 0; private void ultraDateTimeEditor1_ValueChanged(object sender, EventArgs e) { if(counter == 0) if (((UltraDateTimeEditor)sender).IsInEditMode) ((UltraDateTimeEditor)sender).Editor.ExitEditMode(true, true); counter++; }
Let me know if this helps or counteracts what you have in place already.
Hello,
By the way the condition itself is actually the root of the cause and it is expected for an exception to be thrown because you are forcing the exit edit mode before it is supposed to. May I ask if you can clarify why this condition is required?
Let me know if you have any additional questions.
Simple... let's say you have a FROM and a TO UltraDateTime. When I either type a date or select a date from the drop down the ValueChange event fires, but the value is not updated UNTIL you exit edit mode by either tabbing to another control or selecting another control via mouse. So what I'm doing now is checking inside the ValueChanged event for IsValidDate and InEditMode and calling ExitEditMode(true,true) so then I can grab the correct date and then use it someplace else.
May I ask what you are trying to do with the date once it's available? Are you updating a datasource somewhere or simply trying to obtain the value?
I attached a sample that shows that you can retrieve the value, as an object, as soon as a date is selected or changed without tabbing out or clicking off of the control.
Thanks, all set with the sample. All I needed to do was handle the AfterCloseUp event.
However, is this a bug or misfeature? If an UltraDateTimeEditor MaxDate is set to LESS than Today, the day #s are all hidden beyond the MaxDate, but "Today" button/link is still visible and it responds to AfterCloseUp, yet Value remains unchanged because of the MaxDate violation.
Should the "Today" button also be invisible? Or is there a way to find out IF the user did in fact only click the "Today" button? Thanks.
Hello lhardtwk,
I've written this issue up for developer review. The development issue ID is 148435 for CAS-121085-Q8K0L5.
I have opened a private case in our system to update you with any new information after the developers review this. You can also continue to send updates to that case or this thread at any time.
You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing the case on the Account section of the site.
I am following up and wanted to inform you that your issue has been addressed in service release versions WinForms_13.1.20131.2079, WinForms_12.2.20122.2116. Let me know if you have any questions regarding this matter.
This service release is now available under your account at the Infragistics Website. To download the service release, log in to ‘Account’ and select ‘Keys & Downloads’. Select the appropriate tab for this product; then the license key. The available service releases (Hot Fixes) should now be listed on the page.