?
=?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 = " <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
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 = " <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