The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator Syncfusion Team 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.