Validation Controls in FormView

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
 
B

bgano

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top