How to use RegularExpressionValidator instead of RequiredFieldValidator

Discussion in 'ASP .Net' started by Peter, Dec 15, 2003.

  1. Peter

    Peter Guest

    Hi All,

    I would want to use RegularExpressionValidator instead of
    RequiredFieldValidator. I coded ValidationExpression="^[a-
    zA-Z0-9 ]+$">. But it doesn't work. Do you have any idea?

    Thanks,

    Peter
    Peter, Dec 15, 2003
    #1
    1. Advertising

  2. A regular expression validator only fires if there are contents in the
    control. If you need to validate against an expression, and you additional
    require that the user inputs something, then you need to use both validator
    controls.

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows Client
    Windows XP Associate Expert
    --
    More people read the newsgroups than read my email.
    Reply to the newsgroup for a faster response.
    (Control-G using Outlook Express)
    --

    "Peter" <> wrote in message
    news:04b701c3c343$ca66dd70$...
    > Hi All,
    >
    > I would want to use RegularExpressionValidator instead of
    > RequiredFieldValidator. I coded ValidationExpression="^[a-
    > zA-Z0-9 ]+$">. But it doesn't work. Do you have any idea?
    >
    > Thanks,
    >
    > Peter
    Chris Jackson, Dec 15, 2003
    #2
    1. Advertising

  3. Peter

    Guest Guest

    Thanks Chris,
    >-----Original Message-----
    >A regular expression validator only fires if there are

    contents in the
    >control. If you need to validate against an expression,

    and you additional
    >require that the user inputs something, then you need to

    use both validator
    >controls.
    >
    >--
    >Chris Jackson
    >Software Engineer
    >Microsoft MVP - Windows Client
    >Windows XP Associate Expert
    >--
    >More people read the newsgroups than read my email.
    >Reply to the newsgroup for a faster response.
    >(Control-G using Outlook Express)
    >--
    >
    >"Peter" <> wrote in

    message
    >news:04b701c3c343$ca66dd70$...
    >> Hi All,
    >>
    >> I would want to use RegularExpressionValidator instead

    of
    >> RequiredFieldValidator. I coded ValidationExpression="^

    [a-
    >> zA-Z0-9 ]+$">. But it doesn't work. Do you have any

    idea?
    >>
    >> Thanks,
    >>
    >> Peter

    >
    >
    >.
    >
    Guest, Dec 17, 2003
    #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. =?Utf-8?B?R1A=?=
    Replies:
    0
    Views:
    389
    =?Utf-8?B?R1A=?=
    Mar 3, 2005
  2. Brian
    Replies:
    2
    Views:
    4,452
    Brian
    Apr 15, 2005
  3. ad
    Replies:
    2
    Views:
    16,603
    Brock Allen
    May 4, 2005
  4. =?Utf-8?B?SmFu?=
    Replies:
    2
    Views:
    2,706
    =?Utf-8?B?SmFu?=
    May 1, 2006
  5. bhavesh

    Can I Use RequiredFieldValidator inside a repeater ?

    bhavesh, Jan 19, 2007, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    1,103
    Scott M.
    Jan 19, 2007
Loading...

Share This Page