Blog - .NET, ASP.NET, AJAX, Ruby and more
  • Google Banner 2

Dynamic AJAX Control Toolkit – ValidatorCallout Extender

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;
This entry was posted in .NET, AJAX Control Toolkit, ASP.NET and tagged , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

Damien White is a developer in Connecticut that simply loves coding. Ever since he was young, he has had a driving passion for computers and software development, and a thirst for knowledge that just cannot be quenched. He’s happy to share what he knows in his quest to learn as much as possible.