HowTo Use RegularExprValidator and DataList

Discussion in 'ASP .Net Web Controls' started by HelpForNewbie, Oct 1, 2004.

  1. I have a datalist of parameters that I need to validate. Each parameter
    (row) can represent a different data type. Some are dates, some are patterns
    as \d{2}[-]\d{2}. All are kept in the same table as varchar columns.

    How I would like to do is to add a new column to this table that contains
    the regular expression valiadation string in order to validate the associated
    value. For Example:

    ParmName ParmValue RegExp
    StartDate 10/01/2004 [012]?\d\/[0123]?\d\/[0]\d
    ContactTel 999-999-4444 \d{3}[-]\d{3}[-]\d{4}
    ....
    ....

    Is is possible to have the Reg Validator within the EditItem template so row
    each contains the specific reg expr for validation? Could the RegExp column
    be feed into the ValidationExpression property for each row?

    Thank you,

    Jim
     
    HelpForNewbie, Oct 1, 2004
    #1
    1. Advertising

  2. HelpForNewbie

    Teemu Keiski Guest

    Hi,

    yes it should be. Just place the RegExpValidator declaration into separate
    column on the table (and set the ControlToValidate to point the control,
    which of course needs to be a input control, you want to validate). You can
    in ItemDataBound event of the DataList access the validator with per-row
    idea and apply suitable validation expression.

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    http://blogs.aspadvice.com/joteke



    "HelpForNewbie" <> wrote in message
    news:...
    > I have a datalist of parameters that I need to validate. Each parameter
    > (row) can represent a different data type. Some are dates, some are

    patterns
    > as \d{2}[-]\d{2}. All are kept in the same table as varchar columns.
    >
    > How I would like to do is to add a new column to this table that contains
    > the regular expression valiadation string in order to validate the

    associated
    > value. For Example:
    >
    > ParmName ParmValue RegExp
    > StartDate 10/01/2004 [012]?\d\/[0123]?\d\/[0]\d
    > ContactTel 999-999-4444 \d{3}[-]\d{3}[-]\d{4}
    > ...
    > ...
    >
    > Is is possible to have the Reg Validator within the EditItem template so

    row
    > each contains the specific reg expr for validation? Could the RegExp

    column
    > be feed into the ValidationExpression property for each row?
    >
    > Thank you,
    >
    > Jim
     
    Teemu Keiski, Oct 2, 2004
    #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. Gönen EREN

    Datalist in Datalist How?

    Gönen EREN, Aug 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    424
    Gönen EREN
    Aug 22, 2003
  2. acko bogicevic

    DataList in DataList

    acko bogicevic, Nov 10, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    5,569
    acko bogicevic
    Nov 11, 2003
  3. Steve Lloyd
    Replies:
    1
    Views:
    720
    Rick Spiewak
    May 26, 2004
  4. Nevyn Twyll
    Replies:
    8
    Views:
    1,966
  5. Luis Esteban Valencia
    Replies:
    1
    Views:
    503
    John Saunders
    Jan 6, 2005
Loading...

Share This Page