G
Guest
Hi there,
I'm trying to add validator controls dynamically and it's not working. The
code is below.....thanks in advance for any answers.
The control doesn't appear to be showing up in the page.
override protected void OnInit(EventArgs e)
{
RangeValidator r = new RangeValidator();
r.ErrorMessage = m.ErrorText.ToString();
r.ControlToValidate = "tbxAgencyPhone";
r.MinimumValue="2";
r.MaximumValue="3";
r.EnableClientScript=true;
r.Visible=true;
r.Enabled=true;
r.EnableViewState=true;
this.Validators.Add(r);
this.Form1.Controls.Add(r);
}
I'm trying to add validator controls dynamically and it's not working. The
code is below.....thanks in advance for any answers.
The control doesn't appear to be showing up in the page.
override protected void OnInit(EventArgs e)
{
RangeValidator r = new RangeValidator();
r.ErrorMessage = m.ErrorText.ToString();
r.ControlToValidate = "tbxAgencyPhone";
r.MinimumValue="2";
r.MaximumValue="3";
r.EnableClientScript=true;
r.Visible=true;
r.Enabled=true;
r.EnableViewState=true;
this.Validators.Add(r);
this.Form1.Controls.Add(r);
}