all groups > dotnet general > august 2007 >
You're in the

dotnet general

group:

Date format


Date format rkbnair
8/31/2007 1:34:01 PM
dotnet general:
In the below listed code, I can force the users to enter date in mm/dd/yy
format.
I tried the dataformat method. But it does no validation at all.


<asp:templatefield
HeaderText="Ist Installed On" >

<edititemtemplate>
<asp:TextBox

ID="gTextBox_dte_install1st" runat="server"
Text='<%# Bind("dte_install1st")%>'
OnChange="NumericValidation(this.id)">

</asp:TextBox>
Re: Date format rkbnair
8/31/2007 2:56:19 PM
If so, how will the expression code look like?

[quoted text, click to view]
Re: Date format Mihai N.
8/31/2007 6:56:14 PM
[quoted text, click to view]
Another bad internationalization practice :-)
What's wrong with a date picker?

--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Re: Date format Jesse Houwing
8/31/2007 9:27:45 PM
Hello rkbnair,

[quoted text, click to view]

You could use a RegularExpressionValidator, or get yourself a license for
Peter's Date Package (http://www.peterblum.com).

--
Jesse Houwing
jesse.houwing at sogeti.n

Re: Date format Jesse Houwing
9/1/2007 12:37:04 AM
Hello rkbnair,

[quoted text, click to view]

Without actually checking the date itself:

^\d{1,2}/\d{1,2}/\d{2}$

There are more complex expressions going around that actually check the entered
text for correctness (even check for leap years), but it would be better
to use a custom validator and parse the contents both clientside and server
side for that.

Jesse

[quoted text, click to view]
--
Jesse Houwing
jesse.houwing at sogeti.n

AddThis Social Bookmark Button