I have datetimeeditors configured to display time only for a start and end time. I have code behind the form which compares start to end and if end is earlier (i.e. user enters 10:00 PM start and 2:00 AM finish) then it adds one day to the end time (so 06-14-12 2:00 AM becomes 06-15-12 2:00 AM)..
There is a drop down calendar enabled on the editor. However, if the user opens the drop down calendar and selects a different date (i.e. they meant to enter 10:00 AM and 2:00 PM so they need to reverse the action of the code behind the form) the date in the control's value does NOT change.
How can I allow the user to alter the underlying date using the calendar while only displaying and allowing direct editing of the masked time portion?
Hi,
Have you been able to resolve your issue ? Did you try my suggestion. Let me know if you have any questions.
Regards
Maybe one possible approach could be if you are using BeforeCellListDropDown() event of your UltraGrid. For example:
void ultraGrid1_BeforeCellListDropDown(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e){ e.Cancel = true; mc.Parent = ultraGrid1; mc.Location = new Point(ultraGrid1.ActiveCell.GetUIElement().Rect.X, ultraGrid1.ActiveCell.GetUIElement().Rect.Y + 23); mc.Show(); mc.DateSelected += new DateRangeEventHandler(mc_DateSelected);}
Please note that in void mc_DateSelected() event you should replace ultraDateTimeEditor1.DateTime with ultraGrid1.ActiveCell.Value.
Please let me know if you have any questions.
Well, I now know from another thread that the events don't fire for the embedded editor.
What I now need to figure out is what event I can get from the grid to intercept the grid using the DateTimeEditor and instead pop the MonthCalendar up to get the date.
I've tried in the BeforeEnterEditMode event but the problem with that is that it isn't an event where you want to cancel ...
Any thoughts?
I think I have a bit of a hitch.
What I didn't share in my original post is that the DateTimeEditor is actually used as an EditorComponent attached to a DateTime column in an UltraGrid.
I'm working in VB but have translated the sample you posted. If I create a sample form exactly as per your sample it works fine.
But on the UltraGrid, it appears the BeforeDropDown event for the DateTimeEditor doesn't fire - is that possible?
Is there another event I can hook to do this?
Thanks for your feedback. Please do not hesitate to write me if you have any questions.