I've got a UserControl that is essentially just a TextBox with optional built-in validators to it. At the moment this is just a RequiredFieldValidator and RegexValidator. It's easy to just expose properties on the UserControl which get passed through to these validators and allow me to set the RegEx for example.
Now I'd like to add a CustomValidator and allow the user to add a server-side validation function... and this is causing me some trouble. What is the proper syntax for this? I tried just adding a ServerValidateEventHandler property, but when I try to use this I get a runtime error:
Cannot create an object of type 'System.Web.UI.WebControls.ServerValidateEventHandler' from its string representation 'valState_ServerValidate' for the 'ServerValidate' property.
Do I need to expose a delegate in some other way? This should be easy... I'm missing one little key. Please note, I'm trying to add a CustomValidator to a page which uses the UserControl... I want the user to specify a handler for custom validation on the usercontrol itself. (yes, it's a bit of a Frankencontrol)