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. Advertising

  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. 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. Oleg Ogurok
    Replies:
    1
    Views:
    6,306
    William F. Robertson, Jr.
    Jun 25, 2003
  2. Helixpoint

    RegularExpressionValidator for money??

    Helixpoint, Jun 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,760
    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,572
    Vincent V
    Aug 5, 2003
  4. BH
    Replies:
    0
    Views:
    515
  5. Ananda Sim
    Replies:
    0
    Views:
    487
    Ananda Sim
    Aug 18, 2003
Loading...

Share This Page