Bryan
Bryan

Reputation: 8697

ConfirmButtonExtender doesn't cancel

I inserted this confirm button extender into my webpage. I have 2 option that is ok and cancel. When i clicked okay, it updates my database. But when i clicked cancel and also updates my database.

<asp:ConfirmButtonExtender ID="btnClear_ConfirmButtonExtender" runat="server" TargetControlID="btnClear"
ConfirmText="Are you sure you would like to update the following police report? The page will automatically refreshes if the report has been updated successfully"
OnClientCancel="CancelClick" />

I didnt enter any codes in my back-end side. So i guess the problem lies with the source code.

Source Link : ConfirmButtonExtender

Upvotes: 0

Views: 618

Answers (2)

Rahul
Rahul

Reputation: 5636

I believe OnClientCancel specifies a javascript function to call not server side method. Instead of the code you have for CancelClick, use this as a test in your HTML markup to see it in action:

<script type="text/javascript">
    function CancelClick()
    {
        alert('called by javascript');
    }
</script>

Now check that cancel button is still Updating or will show you the called by javascript message on alert.

Hope it clear and works for you.

Upvotes: 0

7alhashmi
7alhashmi

Reputation: 924

Try to remove the OnClientCancel="CancelClick" and add Enabled="true". It should work.

Upvotes: 3

Related Questions