codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  DateTime Control  sardinka at 18:42 on Monday, November 15, 2004
 

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?


  Re: DateTime Control  tgreer at 00:19 on Tuesday, November 16, 2004
 

Use an "if" statement.



  Re: DateTime Control  sardinka at 13:36 on Tuesday, November 16, 2004
 

an ' / / ' is not recognisible as datetime format.

  Re: DateTime Control  tgreer at 15:40 on Tuesday, November 16, 2004
 

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.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  How to dynamically create a calendar when I click a button?
•  c++ tutorials
•  Update a second table
•  Trackin Site behaviour
•  variable scope problem
•  dynamic crystal report generation
•  execute an Excel macro when the sheet is changed from ASP.NET
•  Re: form
•  form


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005