This is a migrated thread and some comments may be shown as answers.

RadButton does not work with .net ajax ConfirmButtonExtender

1 Answer 120 Views
Button
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 09 Feb 2011, 07:11 PM
Hi everyone,

I did not find any forum posts for this though I would think that someone else would have discovered/had an issue with this by now.  It appears to me that the ConfirmButtonExtender does not work with the RadButton control.  Upon canceling the confirm the Click event code is still called.  Is this expected behavior or a legitimate issue?  I am using the latest SP for Q3 2010 ASP.NET controls (2010.3.1317.35).

Thanks,

Adam.g

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 14 Feb 2011, 12:12 PM
Hi Adam,

The RadButton control is not compatible with the AjaxToolkit's ConfirmButtonExtender. The main problem comes from a conflict between the RadButton's client-side functionality, and the extender. The Ajax Extender controls are designed to enhance the client-side functionality of the existing standard ASP.NET controls, which unlike our RadControls for AJAX do not have any client-side functionality. Basically, it is very likely that the AjaxToolkit's Extender controls will not work with our controls, because of conflicts in the client-side functionality.
My suggestion is to use the standard confirm, or the RadWindow's confirm to achieve your scenario:

RadConfirm
<%@ Page Language="C#" AutoEventWireup="true" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <script runat="server">
        protected void RadButton1_Click(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToString();
 
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <script type="text/javascript">
        function OnClientClicking(sender, args)
        {
            var callBackFunction = Function.createDelegate(sender, function (argument)
            {
                if (argument)
                {
                    this.click();
                }
            });
 
            var text = "Are you sure you want to submit the page?";
            radconfirm(text, callBackFunction, 300, 100, null, "Title");
            args.set_cancel(true);
        }
    </script>
    <div>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        </telerik:RadWindowManager>
        <telerik:RadButton ID="RadButton1" runat="server" Text="Single Button with RadConfirm"
            OnClick="RadButton1_Click" OnClientClicking="OnClientClicking">
        </telerik:RadButton>
        <asp:Label ID="Label1" runat="server"></asp:Label>
    </div>
    </form>
</body>
</html>


Window.confirm
<script type="text/javascript">
    function OnClientClicked(button, args, text)
    {
        button.set_autoPostBack(window.confirm(text));
    }
</script>
<div>
    <telerik:RadButton ID="Button1" runat="server" Text="Standard Confirm" CommandArgument="Are you sure?"
        OnClientClicking="function(button,args){args.set_cancel(!window.confirm(button.get_commandArgument()));}">
    </telerik:RadButton>


Greetings,
Pero
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Button
Asked by
Adam
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or