We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GDBG, DateTime,masking and validation

Thread ID:





25315 Feb 24,2005 10:28 AM UTC Feb 24,2005 12:48 PM UTC WinForms 1
Tags: GridControl
Gil Kalo
Asked On February 24, 2005 10:28 AM UTC

I want to create a mask for date time and also disallow user to type an invalid date time. What I did to create this behavior is: 1. Creating a mask as: "##/##/####". 2. Defining a format as: "dd/MM/YYYY". The problems I have are: 1. In this configuration, somehow I''m getting an error of invalid date time, even when I''m entering a totally valid date time? 2. By defining the mask and format, no validation for proper date time value are made?! (For example: User can still enter a month equals to 39). Do I need to do the validation on the date time value my self? Isn''t enough to define the mask and format also to validate the values and not only the scheme? 3. In the following scenarios an error message appears. How can I control the text of these messages? 3.1) If the text I''m entering doesn''t fix the mask scheme, an error with "Invalid Text" appears. 3.2) If "CellValueType" isn''t defined, when trying to submit the value to the table column itself and the type doesn''t match, and error message appear. 3.3) If "CellValueType" is defined, and the value entered doesn''t match the "CellValueType" an error message appears in a different format from the one which appears in "3.2" scenario. Thanks for your help, Gil K

Administrator [Syncfusion]
Replied On February 24, 2005 12:48 PM UTC

If you have our Tools library, the simplest way to edit formatted dates is to put a DateTimePickerAdv in a cell. Here is a sample. http://www.syncfusion.com/support/user/uploads/datepickercell.zip If you do not have tools, then you can catch events and manage the keystrokes yourself. Here is a sample showing this idea. http://www.syncfusion.com/support/user/uploads/9191.zip The need for the error messages goes away if you use teh first technique as that control will not let your user enter an invalid date. If you use the second technique, you can specify the message by setting grid.CurrentCell.ErrorMessage when you set e.Cancel = true to cancel an entry.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon