Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > custom validation

Reply
Thread Tools

custom validation

 
 
Tarscher
Guest
Posts: n/a
 
      02-06-2007
Hi all,

I have a custom validation on server side (I disabled client side).
The validation is inside a user control but doesn't seem to work. For
simplifying things I took out almost all code of the function that the
custom user control calls ( CustomValidator1_ServerValidate) when
clicking a button

protected void CustomValidator1_ServerValidate(object source,
ServerValidateEventArgs args)
{
args.IsValid = false;
}

When I click a button this function get called first but then goes to
the function that handles the buttonclick. I don't see why it stops
and returns an errorstate to the page?

Am I missing something?

Regards,
Stijn

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      02-06-2007
If you don't use client validation (even if you do) you have to test for the
Page.IsValid == true on every postback, there fore in your button click event
handler add following condition .:

protected void btn_Click(object sender, EventArgs e)
{
if (IsValid) // on user / webserver controls use Page.IsValid
{
// do what you did before
}
}
--
Milosz


"Tarscher" wrote:

> Hi all,
>
> I have a custom validation on server side (I disabled client side).
> The validation is inside a user control but doesn't seem to work. For
> simplifying things I took out almost all code of the function that the
> custom user control calls ( CustomValidator1_ServerValidate) when
> clicking a button
>
> protected void CustomValidator1_ServerValidate(object source,
> ServerValidateEventArgs args)
> {
> args.IsValid = false;
> }
>
> When I click a button this function get called first but then goes to
> the function that handles the buttonclick. I don't see why it stops
> and returns an errorstate to the page?
>
> Am I missing something?
>
> Regards,
> Stijn
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Summary Validation control with server Custom validation =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= ASP .Net 2 10-15-2004 06:15 PM
ASP.NET Web Forms Validation Controls are Server-Side or Client-Side Validation? Matt ASP .Net 14 01-30-2004 09:15 AM
Web form validation vs object validation Colin Basterfield ASP .Net 1 11-29-2003 12:10 AM
validation summary doesnt display when there's client-side validation Libs ASP .Net 0 06-25-2003 03:05 PM
Re: only custom validation control does server side validation? Colin Mackay ASP .Net 0 06-25-2003 07:54 AM



Advertisments