ASP.NET 1.1, there are many verification controls, which greatly facilitates us, but sometimes, when you need to do special verification, you will feel insufficient enough, so we can use custom verification control CustomValidator, you want to use this Controls, must write the corresponding event on the server, the format is as follows:
Sub FunctionName (Sender As Object, Args As ServerValidateEventArgs)
...
End Sub
Among them, pay attention to the two parameters value: Indicates which control isvalidator that is currently CustomValidator, is true, indicating that the page control has passed verification. For example, if you have a verification page, you are using the input of the text box.
SUB BTNSUBMIT_CLICK (Sender As Object, E AS Eventargs)
IF page.issalid then
Response.write (" "& txtprimernumber.text & _
"IS, INDEED, A Good Prime Number. i> font>")
Else
Response.write (" "& txtprimernumber.text & _
"IS NOT b> a principle. i> font>")
END IF
End Sub
Sub Primenumbercheck (Sender As Object, Args As ServerValidateEventArgs)
DIM iprime as integer = cint (args.value), iLoop as integer, _
isqrt as integer = cint (Math.SQRT (iPrime))
For iLoop = 2 to isqrt
If iprime mod iiloop = 0 THEN
Args.issalid = false
EXIT SUB
END IF
NEXT
Args.issalid = true
End Sub
script>