Validator Question

Discussion in 'ASP .Net' started by Q. John Chen, Aug 15, 2005.

  1. Q. John Chen

    Q. John Chen Guest

    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
     
    Q. John Chen, Aug 15, 2005
    #1
    1. Advertisements

  2. 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" <> wrote in message
    news:...
    > 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
    >
     
    Grant Merwitz, Aug 15, 2005
    #2
    1. Advertisements

  3. Q. John Chen

    Q. John Chen Guest

    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?
     
    Q. John Chen, Aug 15, 2005
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephan Bour

    Regex validator question

    Stephan Bour, Oct 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    461
    Stephan Bour
    Oct 28, 2003
  2. TN Bella

    Validator question

    TN Bella, Jun 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    395
    TN Bella
    Jun 15, 2004
  3. Ken Varn
    Replies:
    1
    Views:
    2,803
    Peter Blum
    Nov 2, 2004
  4. MattB

    Custom Validator newbie question

    MattB, Nov 23, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,149
    Teemu Keiski
    Nov 23, 2004
  5. Skeptical

    Required Field Validator question

    Skeptical, Apr 1, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,913
    Skeptical
    Apr 1, 2005
  6. David Hearn
    Replies:
    2
    Views:
    3,416
    David Hearn
    Apr 18, 2005
  7. tshad

    Validator question on positioning

    tshad, Jun 7, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    601
    tshad
    Jun 7, 2005
  8. Replies:
    4
    Views:
    1,219
    Richter~9.6
    Feb 13, 2007
Loading...