Cancel Submit ASP.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I cancel submit process if certain fields are not filled in my
ASP.NET form? I need to know how to do it using the Click sub for the
submit button (in the .vb file) and not using javascript, if possible.
 
No_Spam said:
How do I cancel submit process if certain fields are not filled in my
ASP.NET form? I need to know how to do it using the Click sub for the
submit button (in the .vb file) and not using javascript, if possible.

When the server event of the button is running, the request has already
reached the server, so it's way too late to stop it.
 
How do I cancel submit process if certain fields are not filled in my
ASP.NET form? I need to know how to do it using the Click sub for the
submit button (in the .vb file) and not using javascript, if possible.

I don't believe it's possible to do this without JavaScript...
 
How do I cancel submit process if certain fields are not filled in my
ASP.NET form? I need to know how to do it using the Click sub for the
submit button (in the .vb file) and not using javascript, if possible.

Normally you'd use a RequiredFieldValidator, but since you explicitly
say that you've reached SERVER code you must use your own logic...
What about:
if( InputFieldsValid() )
{
/*...do something...*/
}

??

..t
 
Back
Top