473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Validations......

In my ASP.Net application I am using textbox for user to enter the date.
How to enforce the user to enter only the numeric values( and "/" character)
in this edit box ?
Thanks for your suggestions.
Gary
Nov 18 '05 #1
5 1119
Use a regular expression validator with the date format you want as its
ValidationExpression.
"Gary Smith" <GS******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
In my ASP.Net application I am using textbox for user to enter the date.
How to enforce the user to enter only the numeric values( and "/" character) in this edit box ?
Thanks for your suggestions.
Gary

Nov 18 '05 #2
Jon
Hi Gary,
how would you deal with different date formats though, eg
today is 15/02/04 where I am (UK) but 02/15/04 in USA. I'd say it's much
safer to present dropdowns for day/month/year and then build the date server
side. You could also add some javascript so a user can't enter something
like 30 February

Jon

"Gary Smith" <GS******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
In my ASP.Net application I am using textbox for user to enter the date.
How to enforce the user to enter only the numeric values( and "/" character) in this edit box ?
Thanks for your suggestions.
Gary

Nov 18 '05 #3
The CompareValidator handles this correctly. Set its Operator property to
"DataTypeCheck" and Type="Date". The page's current thread provides the
CultureInfo object that dictates the date format. Usually users set the <@
Page Culture= > attribute. In your case, Culture="en-GB".

FYI: If you are looking for a more powerful date text box that handles
formatting, localization, validation and has a popup calendar, look at my
product "Peter's Date Package" at
http://www.peterblum.com/datecontrols/home.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Jon" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:e9*************@tk2msftngp13.phx.gbl...
Hi Gary,
how would you deal with different date formats though, eg
today is 15/02/04 where I am (UK) but 02/15/04 in USA. I'd say it's much
safer to present dropdowns for day/month/year and then build the date server side. You could also add some javascript so a user can't enter something
like 30 February

Jon

"Gary Smith" <GS******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
In my ASP.Net application I am using textbox for user to enter the date.
How to enforce the user to enter only the numeric values( and "/"

character)
in this edit box ?
Thanks for your suggestions.
Gary


Nov 18 '05 #4
I disagree. You simply put next to the textbox how you want the data
entered: _________ (mm/dd/yyyy). This is easy for the user of the page
to understand and easy to set up the validation control to check for.
"Jon" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:e9*************@tk2msftngp13.phx.gbl...
Hi Gary,
how would you deal with different date formats though, eg
today is 15/02/04 where I am (UK) but 02/15/04 in USA. I'd say it's much
safer to present dropdowns for day/month/year and then build the date server side. You could also add some javascript so a user can't enter something
like 30 February

Jon

"Gary Smith" <GS******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
In my ASP.Net application I am using textbox for user to enter the date.
How to enforce the user to enter only the numeric values( and "/"

character)
in this edit box ?
Thanks for your suggestions.
Gary


Nov 18 '05 #5
Jon
right, my post was from a user's standpoint rather than a programming one.
As a user I dislike sites that ask for dates as mm/dd/yy - it's this
attitude that everyone has to do things the American way. Just my 2 pence
(cents :-)

Jon

"Peter Blum" <PL****@Blum.info> wrote in message
news:uJ**************@tk2msftngp13.phx.gbl...
The CompareValidator handles this correctly. Set its Operator property to
"DataTypeCheck" and Type="Date". The page's current thread provides the
CultureInfo object that dictates the date format. Usually users set the <@
Page Culture= > attribute. In your case, Culture="en-GB".

FYI: If you are looking for a more powerful date text box that handles
formatting, localization, validation and has a popup calendar, look at my
product "Peter's Date Package" at
http://www.peterblum.com/datecontrols/home.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Jon" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:e9*************@tk2msftngp13.phx.gbl...
Hi Gary,
how would you deal with different date formats though, eg
today is 15/02/04 where I am (UK) but 02/15/04 in USA. I'd say it's much
safer to present dropdowns for day/month/year and then build the date

server
side. You could also add some javascript so a user can't enter something
like 30 February

Jon

"Gary Smith" <GS******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
In my ASP.Net application I am using textbox for user to enter the date. How to enforce the user to enter only the numeric values( and "/"

character)
in this edit box ?
Thanks for your suggestions.
Gary



Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Naresh Agarwal | last post by:
Hi I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing. I want to perform schema validations on the xml. The problem is that root element of XML document does not have...
0
by: babash | last post by:
I designed a site with asp.net all pages are working properly on my local computer but when I upload the sit on the server on those pages that I have field validation, Buttons doesn’t work. When...
19
by: Gérard Talbot | last post by:
posted to: alt.html and comp.infosystems.www.authoring.html followup-to: comp.infosystems.www.authoring.html Hello all, I have 2 questions about validations. 1- What's basically the...
0
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
1
by: DotNetJunkies User | last post by:
I successfully implemented this poup calendar control in C#. But the problem I am having is that the button click is posting back and the validator is getting fired which is asking all the required...
1
by: Murat YILMAZ | last post by:
Hi all, I have develop a web page and there are 4 textbox on it. I have put 4 validation for these. Issue is that If I have request this page and submit form validations are not working. But I...
1
by: anil kumar via .NET 247 | last post by:
(Type your message here) hi, i am using save & cancel webform buttons in my webpage to withsome validations , when i am trying to save my content it issaved that time i need a popup msg like ur...
1
by: Anup | last post by:
In my form I and doing validations using 'Javascript' as I m using ASP1.1 and there is very less support for Validators there. //Code Behind private void Page_Load(object sender,...
2
by: prakashsurya | last post by:
Hello I am going through the validations in a form I would like to know the validations to be considered in writing javascript for email id so would u plz help me in writing the necessary...
2
by: swethak | last post by:
hi , i write the code in .htm file. It is in cgi-bin/searches/one.htm.In that i write a form submitting and validations.But validations are not worked in that .htm file. I used the same code in my...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.