form postback and validation
Hi,
I am new to .Net and come from Java.
I have a form in a page. I tell the form to go to a second page in the Button object with postbackurl. Before, I make some validation using a CustomValidator. The method in the validator just sets the args.IsValid to false. In case of a bad validation, I am redirected to the second page, instead of staying at the same page, though the validation method is called.
My code:
Validation:
public void myValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
if (...)
{
args.IsValid = false;
}
}
Button definition:
Any hint on what goes wrong?
Thank you
Samuel
Munir ShaikhPosted Jul 30, 2007, 6:44 AM
Instead of writing your own code microsoft had already provided with the facility called as "Page.IsValid" which will check if page validation true or false the you can redirect to particular page
Regards,
>>Munnamax