Hello,
I put a compare validator in to my applications and set the type as Date. It
works for “MM/dd/yyyy” but not for “MM/dd/yyyy hh:mm:ss”. How can I validate
time part too?
Thanks, 4 6141
None of the built in validators handle time. When you use Type=Date, it only
means date.
You have several choices:
1. Create a custom validator that will handle the format you want.
2. I recommend splitting the date and time into two textboxes. This will
help the user in several ways:
- You can use a DatePicker with popup calendar for the date. There are many
available
- There are many separate time entry controls.
- You can assign a validator to individual textboxes and just validate the
format of a single data element. (With Date+Time, you have two elements that
may be incorrect. Users appreciate error messages that are specific.)
I created one of the available datepickers and time textboxes with my
Peter's Date Package ( http://www.peterblum.com/datecontrols/home.aspx). You
can see a demo of date + time working together here: http://www.peterblum.com/DateControl...Main.aspx#Demo (see "Demo 5").
My two controls are actually connected so that you assign one DateTime
object and puts the parts into the individual controls.
In addition, I've included validators for date and time.
--- 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
"JIM.H." <JI**@discussio ns.microsoft.co m> wrote in message
news:86******** *************** ***********@mic rosoft.com... Hello,
I put a compare validator in to my applications and set the type as Date. It works for "MM/dd/yyyy" but not for "MM/dd/yyyy hh:mm:ss". How can I validate time part too?
Thanks,
Hi,
I think you cannot do it using compare validator. Use Customvalidator
instead.
--
Milosz Skalecki
MCP, MCAD
"JIM.H." wrote: Hello,
I put a compare validator in to my applications and set the type as Date. It works for “MM/dd/yyyy” but not for “MM/dd/yyyy hh:mm:ss”. How can I validate time part too?
Thanks,
I have never used CustomValidator , is there any example to show me what
exactly I should do?
"Milosz Skalecki" wrote: Hi,
I think you cannot do it using compare validator. Use Customvalidator instead. -- Milosz Skalecki MCP, MCAD
"JIM.H." wrote:
Hello,
I put a compare validator in to my applications and set the type as Date. It works for “MM/dd/yyyy” but not for “MM/dd/yyyy hh:mm:ss”. How can I validate time part too?
Thanks,
Hi,
This is very simple. Here you have quick tutorial tu validatiors: http://samples.gotdotnet.com/quickst...alidation.aspx
--
Milosz Skalecki
MCP, MCAD
"JIM.H." wrote: I have never used CustomValidator , is there any example to show me what exactly I should do?
"Milosz Skalecki" wrote:
Hi,
I think you cannot do it using compare validator. Use Customvalidator instead. -- Milosz Skalecki MCP, MCAD
"JIM.H." wrote:
Hello,
I put a compare validator in to my applications and set the type as Date. It works for “MM/dd/yyyy” but not for “MM/dd/yyyy hh:mm:ss”. How can I validate time part too?
Thanks, This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stephen |
last post by:
Can someone help me. I'm trying to use the following validator control and
compare a date to a date defined in the code-behind page. My code is below
along with my error message I get when the page is rendering in the browser.
Has anyone any idea what I've done wrong?
<asp:CompareValidator ID=cvDate Font-Size=small ForeColor=red Runat=server
ErrorMessage="Please work" Operator=LessThanEqual Type=Date
ControlToValidate=txtStartDate...
|
by: dotnet beginner |
last post by:
In my webform I check for dirty(textbox values changed),
and pop up a confirm dialog box on an asp-Imagebutton
click event.
I wrote a javascript function (to pop up confirm box) and
called it in the pageload event using:
btnclick.attributes.add("onclick", "return popConfirm();")
So far everything works absolutely fine.
Then I added a compare validator to one of the fields in
my form. Now, when the form is dirty (has the values in
|
by: TN Bella |
last post by:
Hi,
I am trying to get my compare validator to fire properly...Since I have
panels the validator wouldn't work properly, the app would fire right
but would insert the data regardless and the user couldn't fix an error
if they had an error. So I added another sub and fixed the panels, but
the compare validator still doesn't work right.
Right now the validator pops up with the error that the two values
(txtAcctAmtSum and txtInvAmt) are...
|
by: babz |
last post by:
Hi
I am facing one peculiar problem. When I tried to compare control value
with the current date, it is not validating. All I am doing is
in the Page Load I have a code
cmp1.ValueToCompare = System.DateTime.Today.ToString("MM/dd/yyyy");
and my validator code is
|
by: Assimalyst |
last post by:
Hi,
I have a working script that converts a dd/mm/yyyy text box date entry
to yyyy/mm/dd and compares it to the current date, giving an error
through an asp.net custom validator, it is as follows:
function doDateCheckNow(source, args)
{
var oDate = document.getElementById(source.controltovalidate); //
dd/mm/yyyy
| |
by: Mike P |
last post by:
What date format does the Compare Validator check against? The date
format of the web server or of the client?
<asp:CompareValidator ID="CompareValidator2" runat="server"
Display="None"
ErrorMessage="Please enter a valid date in format dd/mm/yyyy"
ControlToValidate="txtDueDate" Type="Date"
Operator="DataTypeCheck"></asp:CompareValidator>
|
by: David Hearn |
last post by:
I have a user control that I created that I use in one page right now. It
has a textbox in it that is used to enter a date. I am using a compare
validator to validate the date format which works fine if you enter a date
and then use the tab key to leave the control. The problem is that it should
also be firing if the date is not correctly formatted when the user clicks
on a button that is in the parent page. The button has the...
|
by: hellboss |
last post by:
Hi Every one !
Im using asp .net vs05 , i My form im using two text boxes where the Date is entered in any format (dd/mm/yyy or dd/MMM/yyyy)
Ex : From date ,To Date
Now ! How do i Ensure that Todate is not Greater than the From Date, Is it Feasible with Asp.net Compare Validator ??
Kindly Provide me with a valid Solution !!!
Thanks in Advance !
|
by: vrparekh |
last post by:
in my webapplication,user pick date in dd/mm/yy format,
and i want to compare that date with another date using compare validator but
compare validator compare the dates using mm/dd/yy format.
is there any way to change the format of date,used by compare validator.??
vishal parekh
|
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |