473,545 Members | 2,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

use CompareValidato r to validate date format

Neo
I use CompareValidato r to validate a date. But CompareValidato r can only one
date format at one time. if the dateorder is "mdy", date format can only be
mdy even if date format is ymd. But users of a web application may be
around the world and since database can accept many date format, so are
there any ways to let CompareValidato r accept many data formats at one
time?

Thanks
Nov 18 '05 #1
1 2658
The page sent to the browser only needs to handle the one date format of the
user. Your task is to identify the format of the user who is requesting the
page. Once done, you set
System.Threadin g.Thread.Curren tThread.Current UICulture =
System.Globaliz ation.CultureIn fo.CreateSpecif icCulture("[the Culture Name]")

Please see the .net documentation for the CultureInfo class to understand
about Culture Names.

Here are some ways to identify the user's culture:
1. Have the user pick their culture as they enter the site and keep that
information in the Session
2. If the user logs in, keep their culture with their login data
3. The browser passes a list of culture names in Request.UserLan guages. See
the .net docs for that property. Be aware that often UserLanguages is an
empty collection and you need to provide a default.

There is one more way to do this: Show the format you want right on the
page.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx
and "Peter's Date Package" at
http://www.peterblum.com/datecontrols/home.aspx

"Neo" <ne******@hotma il.com> wrote in message
news:ew******** ********@TK2MSF TNGP12.phx.gbl. ..
I use CompareValidato r to validate a date. But CompareValidato r can only one date format at one time. if the dateorder is "mdy", date format can only be mdy even if date format is ymd. But users of a web application may be
around the world and since database can accept many date format, so are
there any ways to let CompareValidato r accept many data formats at one
time?

Thanks

Nov 18 '05 #2

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

Similar topics

1
1661
by: Jorge EA | last post by:
Hi there, According to the following article, a textbox for a date entry field can be validated with a CompareValidator: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskvalidatingagainstdatatype.asp My question is: which date format would the validator consider correct, the one on the web server or the...
2
3182
by: Eric Maia | last post by:
I have a textbox (StartDateTextBox) in a UserControl on my page, that is supposed to have a date entered into it. I have a RequiredFieldValidator that has its ControlToValidate property set to the textbox. I also have a CompareValidator pointed to the textbox with its Type="Date." Despite all documentation to the contrary, I am getting an...
3
9516
by: CyberLotus | last post by:
Hi, I wish to validate the date a user has entered against the format dd-mmm-yyyy using the CompareValidator, but it does not work. Does anybody have a simple solution please? Many thanks in advance.
1
1450
by: R.A.M. | last post by:
Hello, (Sorry for my English...) Could you help me please? I have a problem with CompareValidator control which makes the load of my page infinitive. Here's the code: Date of birth: <asp:TextBox ID="BirthDate" runat="server" /> <asp:CompareValidator ID="BirthDateValidation" runat="server" ControlToValidate="BirthDate" Type="Date"...
0
974
by: Groove | last post by:
I have a form that has several fields which accept integers. These fields are mileage fields so the value in the fields is easily in the hundreds of thousands. Ex: 152,750. The form loads existing data and lets users update it. When the form loads the data, I format it in the field as a "number" to make it easier to read like so: ...
1
1929
by: Jason | last post by:
I have a textbox that I want to validate a textbox for a date like "01/01/2000 03:00PM" The below validates nicely for 01/01/2000. What's the easiest way to do this in asp.net 2.0 / vb.net? </head> <body>
1
3148
rrocket
by: rrocket | last post by:
I keep getting this error: String was not recognized as a valid DateTime. when I try to sumbit a form with this <asp:TextBox ID="tbDate" runat="server"></asp:TextBox> <cc1:CalendarExtender id="bdplPickupDate" runat="server" TargetControlID="tbDate" Format="MM-dd-yyyy" PopupButtonID="tbDate"> ...
1
1894
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
Is there a way to validate a usercontrol's property from the page hosting the control using a comparevalidator control? such as? <asp:CompareValidator id="cvStartDate" runat="server" ControlToValidate="how to reference a usercontrol's property here??" Operator="DataTypeCheck" Type="Date" ErrorMessage="Please enter a valid start date...
0
2417
by: =?Utf-8?B?VmFuY291dmVyTWlrZQ==?= | last post by:
Hi there, I have a web app written in 1.1 in ASP.net and C#. In the web app, I need to compare two dates (from and to) from two textboxes on webpage to make sure the to date is greater than or equal to from date, by using comparevalidator control. The app is working fine in production server, but recently when I put the code into...
0
7464
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7413
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5323
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4943
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3440
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.