PDA

View Full Version : [CLOSED] ajaxToolkit:ConfirmButtonExtender not working with ext:button



Jurke
Sep 26, 2008, 5:59 AM
Hi
Im trying to use the ConfirmbuttonExtender with a ext:button, that does not work. It generates a javascript error. Does coolite have their own control that I can use instead of the "ConfirmbuttonExtender"




<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Test</title>
</head>
<body>
<form id="Form1" runat="server">


<asp:ScriptManager ID="ScriptManager2" runat="server" />
<ext:ScriptManager ID="ScriptManager1" runat="server" />


<ext:Button ID="Button1" runat="server" Text="Submit" />


<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="Button1" ConfirmText="Är du säker?" />
</form>
</body>
</html>


Best regards
Mikael Jürke

geoffrey.mcgill
Sep 26, 2008, 7:59 AM
Simply setting the <ext:Button> OnClientClick property, or setting a <Click> Listener would reproduce the functionality and avoid having to use another control.

Example


<%@ Page Language="C#" %>


<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<script runat="server">


protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("Confirmed!");
}
</script>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />

<ext:Button
ID="Button1"
runat="server"
&#111;nclick="Button1_Click"
Text="Submit"
AutoPostBack="true"
OnClientClick="return confirm('Please confirm')"
/>
</form>
</body>
</html>
Hope this helps.

Jurke
Sep 26, 2008, 9:54 AM
Hi
Thanks that worked! But with the toolit extender you can hook you own div to the confirmation so that it can be custom build. This is not very important to me, Im just wondering if anything like this will be implemented in your package?

Best regards
Mikael Jürke

geoffrey.mcgill
Sep 26, 2008, 10:01 AM
But with the toolit extender you can hook you own div to the confirmation so that it can be custom build.

Can you link to sample demonstrating that functionality?

Jurke
Sep 26, 2008, 10:22 AM
Yes sure.
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ConfirmButton/ConfirmButton.aspx