Click here to Skip to main content
16,017,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've included the ScriptManager to the page, then attached the ConfirmButtonExtender to a button click event. Everything shows up correctly in the properties of the button but no Confirm Window shows when the button is clicked. A white border shows around the button when the button is clicked, but no Confirm Window.

There is the Registration at the top of the ASP page:
HTML
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

Then I added the ScriptManager:
ASP.NET
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="true">
</asp:ScriptManager>>

Here is the code:
ASP.NET
<asp:Button ID="btnGetSelectedReports" runat="server" 
    Text="Download Selected Report(s)" 
    OnClick="btnGetSelectedReports_Click" BackColor="#337AB7" 
    ForeColor="White" Width="500px" Height="36px" Font-Bold="True" 
    Font-Size="Medium" />      
<asp:ConfirmButtonExtender ID="btnGetSelectedReports_ConfirmButtonExtender" 
    runat="server" 
    BehaviorID="btnGetSelectedReports_ConfirmButtonExtender" 
    ConfirmText="The selected report(s) will be written to your folder. Do you wish to continue?" 
    TargetControlID="btnGetSelectedReports" 
    OnClientCancel="btnClearAll_Click()">
</asp:ConfirmButtonExtender>

In the web.config:
HTML
<controls>
    <add tagPrefix="ajaxtoolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolKit"/>
</controls>

Nothing seems to work, it always goes to the next page on a redirect and completes all steps prior to switching to the new page, bypassing a Confirm Window.

I would appreciate any help,

Jack

What I have tried:

I added and changed several ways of attaching the ConfirmButtonExtender.

I've added different lines to the web.config files.
Posted
Updated 13-Oct-20 8:33am
v2

1 solution

I believe you missed adding ToolkitScriptManager

You must add a ToolkitScriptManager control to any page that contains Ajax Control Toolkit controls. The ToolkitScriptManager performs two main functions.


First, the ToolkitScriptManager handles dependency resolution. The ToolkitScriptManager is responsible for loading all of the JavaScript files required by a set of Ajax Control Toolkit controls.


Second, the ToolkitScriptManager is responsible for optimizing JavaScript and files. The ToolkitScriptManager combines, minifies, compresses and caches JavaScript files so that they can be delivered more efficiently to the browser.


So, try something like:
ASP.NET
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
.
.
.
.
.
<span class="style1"><strong><span class="style2">Click on Submit Button and 
Confirm with OK Button</span></strong></span><br />
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<br />
<asp:TextBox ID="TextBox1" runat="server" >Test data entered</asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" />

<asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID ="Button1" ConfirmText = "Are you want to submit?"></asp:ConfirmButtonExtender>
.
.

For knowing all about it and samples, ajaxtoolkit website is good enough: Ajax control toolkit ToolkitScriptManager example with demo[^]
 
Share this answer
 
Comments
Member 14954403 13-Oct-20 14:52pm    
I looked at adding ToolkitScriptManager but the current version (20.1.0) that I'm using, of the Control Toolkit does not include it but from what I read using the available AJAX Extensions in the VS Toolbar is sufficient. Are you recommending finding the AJAX ScriptManager?
Sandeep Mewara 13-Oct-20 16:55pm    
Can you share where you read "I read using the available AJAX Extensions in the VS Toolbar is sufficient"

I have used it in past and exactly as snippet shared.
Member 14954403 13-Oct-20 20:23pm    
I read literally hundreds of articles trying to figure out this issue, so it will take me a bit to find it. Do you know what version you are using?
Member 14954403 14-Oct-20 23:15pm    
Excellent! I added a line in web.config file:
<add assembly="AjaxControlToolkit, Version=3.5.7.123, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e">

And Edited this line:
<controls>
<add tagprefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=3.5.7.123, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e">


Put this at the top of the Page:
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

Edited this to fit:
Click on Submit Button and
Confirm with OK Button

<asp:toolkitscriptmanager id="ToolkitScriptManager" runat="server">

<asp:button id="btnGetSelectedReports2" runat="server" text="Download Selected Report(s)" onclick="btnGetSelectedReports_Click" backcolor="#337AB7" forecolor="White" width="500px"
="" height="36px" font-bold="True" font-size="Medium" usesubmitbehavior="False" style="color:#0000ff;text-align:left;">
<asp:confirmbuttonextender id="ConfirmButtonExtender1" runat="server" confirmtext="The selected report(s) will be written to your folder. Do you wish to continue?"
="" targetcontrolid="btnGetSelectedReports2" onclientcancel="btnClearAll_Click()">

And Lo and Behold my Confirm Window showed up!

Thanks again,

Jack

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900