Validation Controls in FormView

  • Thread starter Thread starter Q. John Chen
  • Start date Start date
Q

Q. John Chen

I have Validation controls on FormView.
ClientScripts is enabled
FormView's DefaultMode is ReadOnly. And I have button so it will
swith to Insert or Edit mode.


To be specific, I have a RequiredFieldValidator to validate a
dropDownList and a RegEx validator to validate a text box.

The client script is enable but it does nothing and PostBack happens
anyway. So I have to add code in ItemInserting event:
Page.Validate("InsertValidationGroup") // See Note 1

if ( !Page.IsValid )
{
e.Cancel = true;
return;
}

Also, I can see a brink of the display of the error message before I
step to the above code. It might be of the client script. But it posted
back anyway.

Any idea why the client script does not stop postback?

John
 
Could you please post the code you are using? It's difficult to know
what is wrong without seeing what you're using. Specifically, it would
be helpfull to see your validator controls and the controls they are
meant to validate.

-bgano
 
Back
Top