Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hi,

                                    I tried to change the default time from 12:00AM to 09:00AM when user types the first character in the date Edit.

                                    private void dateEdit1_KeyDown(object sender, KeyEventArgs e)
                                            {
                                                if (dateEdit1.DateTime == DateTime.MinValue)
                                                    dateEdit1.DateTime = System.DateTime.Today.AddHours(9);
                                            }

                                    However, after change the date through KeyDown, the dateEdit does not work. It only accepts the first digits for DD, user clicks 11, it only display 1. user click 12, it display as 2. Same thing for MM, YYYY and others.

                                    Enter event works fine but we want the user to type inside the control to avoid user uses TAB KEY to create dummy data.

                                    Please advice. Thanks,

                                    Karen

                                0

                                I also tried to set dateEdit1.EditValue = System.DateTime.Today.AddHours(9);

                                the same behaivor as seting DateTime.

                                Thanks,
                                Karen

                                0

                                Hi Karen,

                                Thank you for your question.

                                This behavior is by design. After accessing the DateEdit.DateTime and DateEdit.Edit value properties, currently pending edit actions are flushed. This logic is implemented to prevent the saving or returning of possibly incomplete data. To accomplish this task, I suggest you handle the DateEdit.KeyPress event, set the DateEdit.DateTime value as your needs dictate, and set the KeyPressEventArgs.Handled property to True. I have created a sample project to demonstrate this approach in action. Please let us know whether or not this solution meets your requirements. If not, feel free to reactivate this ticket.

                                Thank you,
                                Pavel.

                                dxSample.zip

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners