CustomValidator

J

Jim Heavey

I have the following code to create a CustomValidator control in code:

'* Add Custom Validator
Dim cvl1 As New CustomValidator()
cvl1.ID = "cvlAddRating"
cvl1.Display = ValidatorDisplay.Dynamic
cvl1.ControlToValidate = "ddladdRating"
cvl1.ErrorMessage = "Must make a selection"
cvl1.EnableClientScript = "False"

Now I want to associate this control to the event for the "ServerValidate"
event. How do I do this. I thught maybe the following code was part of
the solution, but not all.

Dim it As New System.Web.UI.WebControls.ServerValidateEventHandler
(AddressOf Me.ValidateDropDownSelection)

Am I headed in the right direction? How do I assign "it" to the control
(cvl1)?
 
F

Frank Oquendo

Jim said:
Now I want to associate this control to the event for the
"ServerValidate" event. How do I do this.

Just double click the control and start typing.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
J

Jim Heavey

Just double click the control and start typing.

As my original note indicated, I am doing all of this in code, so there is
no object from me to double click on!
 
F

Frank Oquendo

Jim said:
As my original note indicated, I am doing all of this in code, so
there is no object from me to double click on!

So it did. My mistake. Try something like this:

this.CustomValidator1.ServerValidate +=
new ServerValidateEventHandler(CustomValidator1_ServerValidate);

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top