Custom Control and RequiredFieldValidator.Display

  • Thread starter =?iso-8859-1?Q?Andr=E9_Nobre?=
  • Start date
?

=?iso-8859-1?Q?Andr=E9_Nobre?=

Hi all,
I´m having a little trouble with a requiredfieldvalitor in a custom control. I put a validator in runtime, as this code:

protected override void OnInit(EventArgs e)
{
if (this.ValidationRequired)
{
reqField = new RequiredFieldValidator();
reqField.ControlToValidate = this.ID;
reqField.Text = "&nbsp;&nbsp;<img src=\"http://localhost/Extra/Images/Structure/exclamacao.gif\">";
reqField.EnableClientScript = true;
reqField.Display = ValidatorDisplay.Dynamic;
Page.Validators.Add(reqField);
}

}

Ok, this goes to my page fine. But there, in debug mode, I´ve notice that the Display property of my validator is always Static, and not Dynamic, like reqField.Display = ValidatorDisplay.Dynamic instruction. In my page load I´m doing this to see:

foreach (BaseValidator b in Page.Validators)
{
b.Display = ValidatorDisplay.Dynamic;
}

Anyone can help me? I don´t know what else to do.

Thanks!

André Nobre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top