Validator Question

Q

Q. John Chen

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
 
G

Grant Merwitz

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

Q. John Chen

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top