Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Validator Question

Reply
Thread Tools

Validator Question

 
 
Q. John Chen
Guest
Posts: n/a
 
      08-15-2005
Following is the code from msdn:
private void Button1_Click(object sender, System.EventArgs e)
{
RangeValidator1.MinimumValue = txtArrival.Text;
RangeValidator1.MaximumValue = txtDeparture.Text;
RangeValidator1.Type = ValidationDataType.Date;
RangeValidator1.Validate();
if (!RangeValidator1.IsValid)
{
RangeValidator1.ErrorMessage = "The tour date must " +
"fall between the arrival and departure dates.";
}
}

It calls the Validate when the user entered the value.

My question. The validation control perform validate automatically. So
my guess is that the Validate() is already called AUTOMATICALLY BEFORE
the click event.

Am I right? or,
Is there a way to stop the autmatically calling of the validate()
method?

I my application, I actually have a customer Validator and no client
side validation.

Thanks

JOhn

 
Reply With Quote
 
 
 
 
Grant Merwitz
Guest
Posts: n/a
 
      08-15-2005
This can be changed by setting the EnableClientSideScript attribute to
false.

After doing this, to check if the page is valid you'll have to use
if(Page.IsValid) in your code behind

"Q. John Chen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Following is the code from msdn:
> private void Button1_Click(object sender, System.EventArgs e)
> {
> RangeValidator1.MinimumValue = txtArrival.Text;
> RangeValidator1.MaximumValue = txtDeparture.Text;
> RangeValidator1.Type = ValidationDataType.Date;
> RangeValidator1.Validate();
> if (!RangeValidator1.IsValid)
> {
> RangeValidator1.ErrorMessage = "The tour date must " +
> "fall between the arrival and departure dates.";
> }
> }
>
> It calls the Validate when the user entered the value.
>
> My question. The validation control perform validate automatically. So
> my guess is that the Validate() is already called AUTOMATICALLY BEFORE
> the click event.
>
> Am I right? or,
> Is there a way to stop the autmatically calling of the validate()
> method?
>
> I my application, I actually have a customer Validator and no client
> side validation.
>
> Thanks
>
> JOhn
>



 
Reply With Quote
 
 
 
 
Q. John Chen
Guest
Posts: n/a
 
      08-15-2005
My question is not about client script.

I am asking that whether or not Validate() is already called
AUTOMATICALLY BEFORE
the click event (After page_load).

If so, how can I provent the automation calling?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts Validator - creditCard validator smrimell@gmail.com Java 4 02-13-2007 08:32 PM
Custom Validator newbie question MattB ASP .Net 3 11-23-2004 08:55 PM
Question about custom validator on UserControl. Ken Varn ASP .Net 1 11-02-2004 05:40 PM
Validator question TN Bella ASP .Net 0 06-15-2004 01:56 PM
Regex validator question Stephan Bour ASP .Net 0 10-28-2003 03:08 PM



Advertisments