ASP.NET 1.1 Bug - Dynamic RE Validator

Discussion in 'ASP .Net' started by =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=, Mar 1, 2006.

  1. I created a regular express validator at runtime as the following, but the
    html was rendered by putting the closing " in the separate line, which makes
    the validation not working, example:

    TableCell cellV = new TableCell();
    RegularExpressionValidator rev = new RegularExpressionValidator();
    rev.ControlToValidate = controlId;
    rev.Text = " *Invalid format";
    rev.EnableClientScript = true;
    rev.Display = ValidatorDisplay.Dynamic;
    rev.ValidationExpression = "^(\d{1,7})$"; <<<<<<<<<<<<<<
    cellV.Wrap = false;
    cellV.Controls.Add( rev );

    The rendered html is
    validationexpression="^(\d{1,7})$
    "

    The regular expression does not work with " in the following line. If I
    removed the NEWLINE to have
    validationexpression="^(\d{1,7})$". Then it works fine.

    This is apprarently the ASP.NET 1.1 bug, does anyone know if there is a fix
    or a workaround?
    =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=, Mar 1, 2006
    #1
    1. Advertising

  2. SORRY, it did NOT put an extra NEWLINE before the closing ". And it is not
    the .NET bug either.

    I retrieved the RE from db table, and the newline was added when it was
    copied from the other db. SQL 2000 was to blame.



    "Steve Wonderful" wrote:

    > I created a regular express validator at runtime as the following, but the
    > html was rendered by putting the closing " in the separate line, which makes
    > the validation not working, example:
    >
    > TableCell cellV = new TableCell();
    > RegularExpressionValidator rev = new RegularExpressionValidator();
    > rev.ControlToValidate = controlId;
    > rev.Text = " *Invalid format";
    > rev.EnableClientScript = true;
    > rev.Display = ValidatorDisplay.Dynamic;
    > rev.ValidationExpression = "^(\d{1,7})$"; <<<<<<<<<<<<<<
    > cellV.Wrap = false;
    > cellV.Controls.Add( rev );
    >
    > The rendered html is
    > validationexpression="^(\d{1,7})$
    > "
    >
    > The regular expression does not work with " in the following line. If I
    > removed the NEWLINE to have
    > validationexpression="^(\d{1,7})$". Then it works fine.
    >
    > This is apprarently the ASP.NET 1.1 bug, does anyone know if there is a fix
    > or a workaround?
    >
    =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=, Mar 1, 2006
    #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. Scott

    Validator/Textbox/Label Bug

    Scott, Apr 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    739
    Scott
    Apr 22, 2004
  2. coollzh
    Replies:
    0
    Views:
    373
    coollzh
    Jun 3, 2004
  3. Roger Kjærnsrød
    Replies:
    1
    Views:
    458
    Peter Blum
    Sep 21, 2004
  4. RedEye
    Replies:
    2
    Views:
    566
    Jason Kester
    Dec 13, 2005
  5. Replies:
    4
    Views:
    885
    Richter~9.6
    Feb 13, 2007
Loading...

Share This Page