Completed
Last Updated: 09 Jul 2018 12:45 by ADMIN
ADMIN
Marin Bratanov
Created on: 30 May 2018 09:04
Category: Ajax
Type: Bug Report
2
jQuery button click in RadAjaxPanel under FireFox in R2 2018 causes TypeError: access to strict mode caller function is censored
Using a hidden button and calling its .click() method is sometimes used to invoke a postback under some application logic conditions. If you use the jQuery method and a RadAjaxPanel, this will no longer work with jQuery3 because its strict mode causes the MS AJAX scripts to throw an error.

Below is a sample repro of the scenario and it shows two of the workarounds. The third workaround is to downgrade jQuery to an older version (for example, 1.11.1 which is the previous version the suite used): https://docs.telerik.com/devtools/aspnet-ajax/controls/scriptmanager/disabling-the-embedded-jquery


        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadCodeBlock runat="server" ID="rcb1">
            <script>
                function clickHiddenButton1() {
                    $telerik.$("#<%=Button1.ClientID%>").click();
                    //workaround 1
                    //__doPostBack("<%=Button1.UniqueID%>", "");
                    //workaround 2
                    //$find("<%=rap1.ClientID%>").ajaxRequest();
                }
            </script>
        </telerik:RadCodeBlock>
        <asp:Button Text="click hidden button" ID="testButton1" OnClientClick="clickHiddenButton1(); return false;" runat="server" />
        <telerik:RadAjaxPanel runat="server" ID="rap1" OnAjaxRequest="rap1_AjaxRequest">
            <asp:Label Text="" ID="Label1" runat="server" />
            <asp:Button Style="display: none;" Text="hidden button" ID="Button1" OnClick="Button1_Click" runat="server" />
        </telerik:RadAjaxPanel>
0 comments