469,926 Members | 1,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

use CompareValidator to validate date format

Neo
I use CompareValidator to validate a date. But CompareValidator 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 CompareValidator accept many data formats at one
time?

Thanks
Nov 18 '05 #1
1 2525
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.Threading.Thread.CurrentThread.CurrentUICul ture =
System.Globalization.CultureInfo.CreateSpecificCul ture("[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.UserLanguages. 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****@PeterBlum.com
Creator of "Professional 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******@hotmail.com> wrote in message
news:ew****************@TK2MSFTNGP12.phx.gbl...
I use CompareValidator to validate a date. But CompareValidator 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 CompareValidator accept many data formats at one
time?

Thanks

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jorge EA | last post: by
1 post views Thread by R.A.M. | last post: by
reply views Thread by Groove | last post: by
1 post views Thread by =?Utf-8?B?RGF2ZQ==?= | last post: by
reply views Thread by =?Utf-8?B?VmFuY291dmVyTWlrZQ==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.