Two simple validation questions

Discussion in 'ASP .Net' started by Alan Silver, Jun 15, 2006.

  1. Alan Silver

    Alan Silver Guest

    Hello,

    A couple fo questions about the easiest way to do some tasks. I'm sure
    both of these can be done with custom controls, but can they be done
    more easily with another validation control?

    1) How would I go about building a validation control that checked that
    a number was entered in a textbox only if a dropdown control was set to
    a certain value? For example, say the dropdown allowed them to choose a
    product, and product A requires a height entering, but none of the
    others do. If they choose product A, they must enter a number, if they
    choose any other product, they don't need to.

    2) What if I want to require a textbox to be filled depending on the
    value of another textbox? For example, if I have a textbox for customer
    account number, then if they enter a number, they don't have to enter
    their address as we will know it from their account. Non-customers would
    not have an account number, so would leave the field blank and be
    required to enter their address.

    TIA

    --
    Alan Silver
    (anything added below this line is nothing to do with me)
    Alan Silver, Jun 15, 2006
    #1
    1. Advertising

  2. Alan Silver

    Brock Allen Guest

    Sounds like you should use the CustomValidator and write all of this custom
    logic in your page.

    -Brock
    http://staff.develop.com/ballen


    > Hello,
    >
    > A couple fo questions about the easiest way to do some tasks. I'm sure
    > both of these can be done with custom controls, but can they be done
    > more easily with another validation control?
    >
    > 1) How would I go about building a validation control that checked
    > that a number was entered in a textbox only if a dropdown control was
    > set to a certain value? For example, say the dropdown allowed them to
    > choose a product, and product A requires a height entering, but none
    > of the others do. If they choose product A, they must enter a number,
    > if they choose any other product, they don't need to.
    >
    > 2) What if I want to require a textbox to be filled depending on the
    > value of another textbox? For example, if I have a textbox for
    > customer account number, then if they enter a number, they don't have
    > to enter their address as we will know it from their account.
    > Non-customers would not have an account number, so would leave the
    > field blank and be required to enter their address.
    >
    > TIA
    >
    Brock Allen, Jun 17, 2006
    #2
    1. Advertising

  3. Alan Silver

    Alan Silver Guest

    In article <>, Brock
    Allen <> writes
    >Sounds like you should use the CustomValidator and write all of this
    >custom logic in your page.


    That's what I thought, but I just wondered if I was missing some easy
    way of doing it.

    Thanks for the reply.

    >-Brock
    >http://staff.develop.com/ballen
    >
    >
    >> Hello,
    >> A couple fo questions about the easiest way to do some tasks. I'm
    >>sure
    >> both of these can be done with custom controls, but can they be done
    >> more easily with another validation control?
    >> 1) How would I go about building a validation control that checked
    >> that a number was entered in a textbox only if a dropdown control was
    >> set to a certain value? For example, say the dropdown allowed them to
    >> choose a product, and product A requires a height entering, but none
    >> of the others do. If they choose product A, they must enter a number,
    >> if they choose any other product, they don't need to.
    >> 2) What if I want to require a textbox to be filled depending on the
    >> value of another textbox? For example, if I have a textbox for
    >> customer account number, then if they enter a number, they don't have
    >> to enter their address as we will know it from their account.
    >> Non-customers would not have an account number, so would leave the
    >> field blank and be required to enter their address.
    >> TIA
    >>

    >
    >


    --
    Alan Silver
    (anything added below this line is nothing to do with me)
    Alan Silver, Jun 19, 2006
    #3
    1. Advertising

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. Colin Mackay
    Replies:
    0
    Views:
    2,678
    Colin Mackay
    Jun 25, 2003
  2. Floppy
    Replies:
    4
    Views:
    357
    Jesper Nordenberg
    Jul 14, 2003
  3. NEWS

    Two simple questions?

    NEWS, Dec 19, 2005, in forum: HTML
    Replies:
    6
    Views:
    385
    Stan McCann
    Dec 19, 2005
  4. GenxLogic
    Replies:
    3
    Views:
    1,243
    andrewmcdonagh
    Dec 6, 2006
  5. Spoofy
    Replies:
    2
    Views:
    250
    J Kenneth King
    Jan 20, 2009
Loading...

Share This Page