How to disable my ASP.NET AJAX ConfirmButtonExtender when page validation fails?

I have a submit button using the Microsoft ConfirmButton Extender to ask: "Are you sure?". However, it fires regardless of whether the page passes the check on the client side.

<asp:TextBox ID="TextBox1" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidatorTextBox1"
    runat="server"
    ControlToValidate="TextBox1"
    ErrorMessage="First name is required"
    Display="Dynamic" />
...
<asp:Button ID="Button1"
    runat="server"
    Text="Submit"
    CausesValidation="True" />
<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtenderButton1"
    runat="server"
    TargetControlID="Button1"
    ConfirmText="Are you sure?" />
...
<asp:ValidationSummary id="ValidationSummary1"
    runat="server"
    ShowMessageBox="True" />

So, if the user leaves the required field blank and clicks the "Submit" button. She will see two message boxes:

One for checking ...

ValidationSummary ShowMessageBox http://img120.imageshack.us/img120/8305/validationzn6.gif

Then one to confirm ...

ConfirmButtonExtender http://img228.imageshack.us/img228/678/confirmationam3.gif

(Note: OK and Cancel both will simply be canceled.)

, , . . ?


Update:

ConfirmOnFormSubmit, :

(ASP.Net): "ConfirmOnFormSubmit" 'ConfirmButtonExtender'.

Validation (ASP.Net): "ConfirmOnFormSubmit" "ConfirmButtonExtender" . <3 >

+3
1

, ConfirmOnFormSubmit TRUE ConfirmButtonExtender.

:

ConfirmOnFormSubmit - , . , ASP.NET, .

: . intellisense , , .

+3

Source: https://habr.com/ru/post/1702312/


All Articles