Groups | Blog | Home
all groups > asp.net building controls > january 2004 >

asp.net building controls : extending the RegularExpressionValidator


Tomk
1/14/2004 11:27:23 AM
I would like to have a RegularExpressionValidator that would also require an
entry. So I opened Reflector and looked at the RegularExpressionValidator
control and found the EvaluateIsValid function. In this function it returns
a true if the ControlToValidate is empty. OK so my thought was to extend
this control, add a 'Required' property and override the EvaluateIsValid
function. Then return false if the 'Required' property is set and the
ControlToValidate is empty. This all seem to work just fine and on my test
program it seemed to work. However in real practice I found that if the
ControlToValidate was empty the form was still submitted. So is seems I
have to dig into the JScript generated by the control. Am I going in the
right direction? What do I override to change the JScript?

Alessandro Zifiglio
1/14/2004 7:39:21 PM
hi Tom,
Surely these articles will help you. It should put you in the right
direction if your looking to extend validator controls.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsupportingup-levelbrowsers.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconregularexpressionvalidatorcontrolsample.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconvalidatorcontrolsamples.asp


[quoted text, click to view]

AddThis Social Bookmark Button