tash

tash

  • NA
  • 1
  • 0

requiredfieldvalidator at runtime

Dec 3 2008 11:01 AM
hi,
i'm creating a certain number of textboxes at runtime and i then want to make sure the user enters some text into them. i have this code but validation is not occuring.

[CODE]
        for (int i = 1; i <= this.participants; i++)
        {
            TextBox tb = new TextBox();
            tb.ID = "tbName" + i;
            RequiredFieldValidator rfv = new RequiredFieldValidator();
            rfv.ID = "required" + i;
            rfv.ControlToValidate = tb.ID;
            rfv.ErrorMessage = "Name is a required field";
            rfv.Enabled = true;
[/CODE]

Answers (3)