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
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