g-spot
asked on
Programmatically adding a custom validator?
How do I programmatically add a custom validator? I thought something like this would do:
Dim validationControl As CustomValidator
validationControl = New CustomValidator()
validationControl.ID = "valAllDOBValidator"
validationControl.ControlT oValidate = "dropDOBDD"
validationControl.Text = "Error Message"
validationControl.CssClass = "highlight"
validationControl.Display = ValidatorDisplay.Dynamic
validationControl.EnableCl ientScript = "False"
validationControl.ServerVa lidate = New ServerValidateEventHandler (AddressOf ALLDOBSValidator_ServerVal idate)
plhOtherInsured.Controls.A dd(validat ionControl )
However I'm getting the following error:
Error 29 'Public Event ServerValidate(source As Object, args As System.Web.UI.WebControls. ServerVali dateEventA rgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
Dim validationControl As CustomValidator
validationControl = New CustomValidator()
validationControl.ID = "valAllDOBValidator"
validationControl.ControlT
validationControl.Text = "Error Message"
validationControl.CssClass
validationControl.Display = ValidatorDisplay.Dynamic
validationControl.EnableCl
validationControl.ServerVa
plhOtherInsured.Controls.A
However I'm getting the following error:
Error 29 'Public Event ServerValidate(source As Object, args As System.Web.UI.WebControls.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER