Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

custom validation


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

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

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc