|
I have a datetime conrol where you can enter month,day,year. However for some cases I would like to display an empty field.
Example
'01/01/1753'
I want the dattime control to display =' / / '
How do I do this?
|
|
|
|
|
an ' / / ' is not recognisible as datetime format.
|
|
|
You need to provide more details.
Here is my guess: since there is no such thing as a "DateTime Control" in .NET (there is a DateTime class, but it isn't a control), you have either 1) created a user control or 2) Have a standard TextBox control in conjunction with a Validator and/or RegEx to format the entry as a date.
Next assumption: when the users enter a certain date (either a specific date or a date within some range), you wish to display, instead, a "non-date" value.
My suggestions:
1) write a more robust RegEx to display what you want.
2) Wrap your "date evaluation" code in a try/catch block, to conditionally do what you want server-side.
3) Re-think your approach. If the business logic calls for a date, then let them enter/display a date. If the business logic calls for dates only in certain conditions, then only prompt for a date when those conditions are met.
If you provide more details, such as
- what Web Server controls are you actually using?
- how are you validating the date/format within the control?
- what events are you using?
- are you working client-side or server-side?
someone here might be able to help you.
|
|
|
|
|
|
|
|
|
|