Hi there,
First if you want to prevent the post from the client browser set
EnableClientScript to true. Second, we can't rely on client script validation
as it's very easy to prepare a page that simply skips it. Anyway, the problem
is you don't check IsValid property before executing database insertion code.
Valdators do not prevent page execution automatically (apart from client
side), therefore before you perfom any action, you need to check if page
passed validation (in other words, if all the validators are valid):
protected void MyInsertButtonClick(object sender, EventArgs e)
{
if (this.IsValid)
{
// insert data to database
}
}
Hope this helps
--
Milosz
"AD" wrote:
Hi,
I have 2 different web pages, both using RequiredFieldValidator's, on
the one page Postbacks are prevented when required fields are blank,
on the other page the validators display the error messages after the
postback has returned, but neither the client side, nor the server
side processing is suppressed (my incomplete data is written to my
table)
Any idea what could be wrong?