Consider the following scenario:
MasterpageFile1:
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Frame.master.vb" Inherits="Project.Frame" ClientIDMode="Static" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server" name="form1">
<asp:ContentPlaceHolder ID="BodyPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
</form>
</body>
</html>
Nested Masterpagefile:
<%@ Master Language="VB" MasterPageFile="/Project/Code/MasterPages/Frame.Master" CodeBehind="Master2.master.vb" Inherits="Project.Master2" %>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyPlaceHolder" runat="server">
<input type="submit" id="btSubmit" runat="server" value="start" class="input" />
<asp:UpdatePanel ID="up" runat="server" UpdateMode="Always">
<ContentTemplate>
<div>CALCULATION RESULT GETS DISPLAYED HERE</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btSubmit" />
</Triggers>
</asp:UpdatePanel>
<ajaxToolkit:UpdatePanelAnimationExtender ID="upae" runat="server" TargetControlID="up">
<Animations>
<OnUpdating>
<Sequence>
<ScriptAction FPS="20" Duration="0.5" script="DoSomething();" />
</Sequence>
</OnUpdating>
<OnUpdated>
<Parallel>
<ScriptAction FPS="20" Duration="0" script="DoSomethingElse();" />
</Parallel>
</OnUpdated>
</Animations>
</ajaxToolkit:UpdatePanelAnimationExtender>
</asp:Content>
An ASPX-Page which loads some Styles.
And the follwing jQuery code:
$(document).ready(function () {
$("#btSubmit").click();
});
This Code triggers the UpdatePanel to Refresh. The OnUpdating Animation is playing, the Server does some calculation stuff and sends the result to the client. The client builds in the result, but the OnUpdatedAnimation nevers plays.
If i change the jQuery code to the follwing, it works fine.
$(document).ready(function () {
setTimeout(function () {
$("#btSubmit").click();
}, 1500);
});
May someone can tell me, why this happens and how to achieve, that the calculation starts when the DOM is ready and not 1.5 seconds later?
Kind Regards, Sören