locked
UpdatePanelAnimationExtender doesn't work when UseSubmitBehavior=false RRS feed

  • Question

  • User1002052364 posted

    I created a page with a button inside an update panel with an UpdatePanelAnimationExtender. When the button property UseSubmitBehavior is set to false, the page throws the following error the first time the button is clicked. This problem started after upgrading to AjaxControlToolkit v15.1.4 and .NET 4.5.1

    Uncaught TypeError: Cannot read property 'id' of undefined
    Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior._partialUpdateBeginRequest @ ScriptResource.axd?d=…:74
    (anonymous function) @ ScriptResource.axd?d=…:47
    (anonymous function) @ ScriptResource.axd?d=…:3484
    Sys$WebForms$PageRequestManager$_onFormSubmit @ ScriptResource.axd?d=…:1284
    Sys$WebForms$PageRequestManager$_doPostBack @ ScriptResource.axd?d=…:824
    (anonymous function) @ ScriptResource.axd?d=…:47
    onclick @ default.aspx:67

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:Button ID="Button1" runat="server" Text="Button" UseSubmitBehavior="false" />
                    </ContentTemplate>
                </asp:UpdatePanel>
                <ajaxToolkit:UpdatePanelAnimationExtender ID="upae" BehaviorID="animation" runat="server" TargetControlID="UpdatePanel1">
                    <Animations>
                    <OnUpdating>
                        <Parallel duration="0">
                            <ScriptAction Script="onUpdating();" />  
                         </Parallel>
                    </OnUpdating>
                    <OnUpdated>
                        <Parallel duration="0">
                            <ScriptAction Script="onUpdated();" /> 
                        </Parallel> 
                    </OnUpdated>
                    </Animations>
                </ajaxToolkit:UpdatePanelAnimationExtender>
                <script type="text/javascript" language="javascript">
                    function onUpdating() {
                        //start doing something
                    }
                    function onUpdated() {
                        //stop doing something
                    }
                </script>
            </div>
        </form>
    </body>
    </html>

     

    Friday, November 27, 2015 8:22 PM

Answers

  • User1002052364 posted

    I repeated the process with v15.1.3 and had the same problem, but v15.1.2 worked without error.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 30, 2015 9:05 PM

All replies

  • User61956409 posted

    Hi gatorrob86,

    We use the UseSubmitBehavior property to specify whether a Button control uses the client browser's submit mechanism or the ASP.NET postback mechanism. Would you like to make the button use the ASP.NET postback mechanism? I’d like to know whether you get the same error if you remove UseSubmitBehavior property from Button.

    Besides, I could not reproduce your problem based on the code you provided, could you show us all relevant code?  

    Best Regards,

    Fei Han

    Monday, November 30, 2015 6:42 AM
  • User1002052364 posted

    When I upgraded to .NET 4.5.1, I had to also upgrade AjaxControlToolkit.  I uninstalled the old version and installed version 15.1.4.  After doing so, all of my pages that use UpdatePanelAnimationExtender started throwing JavaScript errors.  In an effort to isolate the problem, I created the simple test page whose code is in my original post.  That is all the code.  My production pages use UseSubmitBehavior="false" to prevent postback when user hits Enter key on textbox.  I suspect this is an issue with either v15.1.4 or something configured improperly in my development environment.  Can you confirm that you are using v15.1.4?

    Monday, November 30, 2015 1:20 PM
  • User1002052364 posted

    I just uninstalled AjaxControlToolkit via NuGet. I downloaded and ran the installer which installed the sample site. I ran the UpdatePanelAnimation demo and it worked. I then changed UseSubmitBehavior="false" on btnUpdate. When I re-ran and click the button, it throws the error listed below. When I click the button a second time, the animation works and no errors. Each time I check/uncheck one of the effects and click the button, I get no animation on the first click and then it works on subsequent clicks. Any thoughts on what I should try next?

    Unhandled exception at line 1, column 1222337 in localhost:49617/Scripts/AjaxControlToolkit/… 0x800a138f - JavaScript runtime error: Unable to get property 'id' of undefined or null reference

    Monday, November 30, 2015 3:32 PM
  • User1002052364 posted

    I repeated the process with v15.1.3 and had the same problem, but v15.1.2 worked without error.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 30, 2015 9:05 PM