RegularExpressionValidator???

Discussion in 'ASP .Net' started by franz, Sep 9, 2005.

  1. franz

    franz Guest

    does anybody tell me why it doesn't works?? in any case gg beame true

    thanks
    franz

    Dim y As RegularExpressionValidator = New RegularExpressionValidator
    y.ValidationExpression =
    "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
    y.ControlToValidate = "ss5ssss"
    Dim gg As Boolean = y.IsValid
     
    franz, Sep 9, 2005
    #1
    1. Advertisements

  2. franz

    Karl Seguin Guest

    Franz:
    If that's ur code, it doesn't work like that. You don't simply assign the
    controlToValidate and the isValid will be set accordingly. During the
    RaisePostBackEvent, the page calls Validate() on the control which forces
    the validation.

    You might try modifyning your code to do:

    Dim y As RegularExpressionValidator = New RegularExpressionValidator
    y.ValidationExpression =
    "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
    y.ControlToValidate = "ss5ssss"
    y.Validate()
    Dim gg As Boolean = y.IsValid

    But I'm not sure if it'll work because it'll never render. To be honest, if
    you aren't rendering a control, why not just use a System.Text.Regex ??

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)


    "franz" <> wrote in message
    news:...
    > does anybody tell me why it doesn't works?? in any case gg beame true
    >
    > thanks
    > franz
    >
    > Dim y As RegularExpressionValidator = New RegularExpressionValidator
    > y.ValidationExpression =
    > "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
    > y.ControlToValidate = "ss5ssss"
    > Dim gg As Boolean = y.IsValid
    >
     
    Karl Seguin, Sep 9, 2005
    #2
    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. Oleg Ogurok
    Replies:
    1
    Views:
    6,598
    William F. Robertson, Jr.
    Jun 25, 2003
  2. Helixpoint

    RegularExpressionValidator for money??

    Helixpoint, Jun 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    3,005
    Helixpoint
    Jul 1, 2003
  3. Salim Afþar

    regularexpressionvalidator numeric control

    Salim Afþar, Aug 4, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,706
    Vincent V
    Aug 5, 2003
  4. BH
    Replies:
    0
    Views:
    683
  5. Ananda Sim
    Replies:
    0
    Views:
    617
    Ananda Sim
    Aug 18, 2003
  6. MS Newsgroups

    Help with regularexpressionvalidator

    MS Newsgroups, Oct 17, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    544
    MS Newsgroups
    Oct 17, 2003
  7. Mark Dengler

    RegularExpressionValidator help

    Mark Dengler, Nov 20, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    2,025
    Mark Dengler
    Nov 24, 2003
  8. Ricardo Corsi P. Cesar

    how to create a RegularExpressionValidator in runtime ? ?

    Ricardo Corsi P. Cesar, Nov 26, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    4,375
    Nick Hertl
    Dec 15, 2003
Loading...