Syntax for dynamic validation control

Discussion in 'ASP .Net Building Controls' started by Chris Kennedy, Jun 8, 2004.

  1. I want to assign a validation control dynamically. How do I tell it what
    control to validate via the controls collection. It seems to want a string
    when I use the code below. Regards, Chris.

    Controls.Add(New TextBox)
    Dim valRequired as New RequiredFieldValidator()
    Controls.Add(valrequired)
    valrequired.ControltoValidate = Controls(0)
    Chris Kennedy, Jun 8, 2004
    #1
    1. Advertising

  2. "Chris Kennedy" <> wrote in message
    news:...
    > I want to assign a validation control dynamically. How do I tell it what
    > control to validate via the controls collection. It seems to want a string
    > when I use the code below. Regards, Chris.
    >
    > Controls.Add(New TextBox)
    > Dim valRequired as New RequiredFieldValidator()
    > Controls.Add(valrequired)
    > valrequired.ControltoValidate = Controls(0)


    That is correct. ControlToValidate is of type String. It wants the ID of the
    control to validate.
    --
    John Saunders
    johnwsaundersiii at hotmail
    John Saunders, Jun 8, 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. Colin Mackay
    Replies:
    0
    Views:
    2,678
    Colin Mackay
    Jun 25, 2003
  2. Lucas Tam
    Replies:
    2
    Views:
    1,091
    Lucas Tam
    Feb 26, 2004
  3. =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=

    Using Summary Validation control with server Custom validation

    =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=, Oct 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    871
    =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=
    Oct 15, 2004
  4. =?Utf-8?B?U3RldmUgRnVuaw==?=

    Dynamic Wizard with Dynamic Validation Controls

    =?Utf-8?B?U3RldmUgRnVuaw==?=, Oct 13, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    437
    =?Utf-8?B?U3RldmUgRnVuaw==?=
    Oct 13, 2006
  5. Larry Bud
    Replies:
    1
    Views:
    336
    bruce barker
    Jan 10, 2007
Loading...

Share This Page