validation function for your custom validator. Client-side validation
processes the regular expression validator and thinks the page is fine. It
then submits the page. At that point, server side validation is run and
calls all validators including your customvalidator. By design, this step
method. Inside your Click event handler you should *ALWAYS* check the state
"Louis Yeung" <Louis Yeung@discussions.microsoft.com> wrote in message
news:C78C17E3-F48B-4310-B059-4779C5B55893@microsoft.com...
> Brock,
>
> I agree with you after I read another MSDN article. Why my button click
> event did not fire when my regExp validator failed? I checked the
> displayed
> page content and do not believe the regExp validator is running on client.
>
> ..Louis
>
> "Brock Allen" wrote:
>
>> All server events fire, regardless of the outcome of Validation. In your
>> button handler, though, you should be checking Page.IsValid prior to
>> making
>> assumptions about the data the user's provided. IOW, check Page.IsValid
>> before
>> you use the data and save it to your database.
>>
>> It sounds like you're using a CustomValidator without a client side
>> validation
>> routine (which is fine). This is why your request made it to the server.
>> You can also provide a client side javascript validation function if
>> that's
>> useful to you.
>>
>> But again, you should always check IsValid in your event handlers since
>> the
>> user can disbale javascript in the browser.
>>
>> -Brock
>> DevelopMentor
>>
http://staff.develop.com/ballen >>
>>
>>
>> > Hi,
>> >
>> > I am playing with validators using VS2003 on a XP box. I have
>> > textboxes with regExp validators and a button. The validators work
>> > when I press the button. If any validator fails, error messages are
>> > displayed and button click event does not fire (i.e. not hitting my
>> > breakpoint). Everything works as stated. Some error messages are in
>> > line and some are shown in a validationSummary control.
>> >
>> > I added a customValidator to a textbox which already has a regExp
>> > validator. The custom validation code was fired. I set
>> > args.IsValid=false. I was surprised the button click event was fired.
>> > Inside the event handler, I examined the customValidator.IsValid and
>> > WebForm1.IsValid values which are both false.
>> >
>> > According to MSDN , the customValidator should behave like other
>> > validators. Can someone explain why the button event is fired
>> > eventhough the customValidator fails the validation.
>> >
>> > ..Louis
>> >
>>
>>
>>
>>