PC Review


Reply
Thread Tools Rate Thread

custom validation

 
 
Tarscher
Guest
Posts: n/a
 
      6th Feb 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
 
      6th Feb 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
Rate This Thread
Rate This Thread:

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
Custom Wizard Control Validation: MultipleTextBox Validation To Keep ActiveStep Current clintonG Microsoft Dot NET 0 22nd Mar 2007 05:54 PM
Custom Column Validation or DataGrid Cell Validation Stanislav Nedelchev Microsoft ADO .NET 0 15th Dec 2005 10:28 AM
Using Summary Validation control with server Custom validation =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= Microsoft ASP .NET 2 15th Oct 2004 07:15 PM
How to use data validation - Custom validation 0-0 Wai Wai ^-^ Microsoft Excel Discussion 1 7th May 2004 09:04 PM
Re: only custom validation control does server side validation? Colin Mackay Microsoft ASP .NET 0 25th Jun 2003 08:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:04 AM.