Blog - Microsoft .NET, ASP.NET, AJAX and more

Dynamic AJAX Control Toolkit - ValidatorCallout Extender

by Damien White 7/24/2008 8:51:38 AM
Technorati Tags: ,

I added one of these a while ago and figured I would include another.  Dynamic AJAX Toolkit Controls seem to really be an issue for some, so I hope this helps.  This time, we will create a dynamic ValidatorCallout for a TextBox with a RequiredFieldValidator (although you can use any validation method).  One other thing to note on the ValidatorCallout is that  it only works with client-side validation.

TextBox nameTextbox = new TextBox();
nameTextbox.ID = "name";
nameTextbox.MaxLength = 100;

RequiredFieldValidator nameRequired = new RequiredFieldValidator();
nameRequired.ID = "nameRequired";
nameRequired.ControlToValidate = nameTextbox.ID;
nameRequired.ErrorMessage = "Name is required.";
nameRequired.Text = "*";

ValidatorCalloutExtender nameRequiredCallout = new ValidatorCalloutExtender();
nameRequiredCallout.ID = "nameRequiredCallout";
nameRequiredCallout.TargetControlID = nameRequired.ID;
 

Currently rated 4.7 by 3 people

  • Currently 4.666667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Stumble It! kick it on DotNetKicks.com

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading