I am using ScriptManager.RegisterStartupScript to register calls to a large number of JS functions.
ScriptManager.RegisterStartupScript(this, this.GetType(), "Script1", "SomeScript1", true);
ScriptManager.RegisterStartupScript(this, this.GetType(), "Script2", "SomeScript1", true);
ScriptManager.RegisterStartupScript(this, this.GetType(), "EndScript", "EndScript", true);
When the HTML is rendered, it's adding them in order.
<script type="text/javascript">
//<![CDATA[
other functions calls..
SomeScript1();SomeScript2();EndScript();
//]]>
</script>
However, when I step through in debug mode, the execution of scripts are not in order (Ex: EndScript executes first before SomeScript1 or SomeScript2)
Doesn't ScriptManager.RegisterStartupScript gaurantee execution in the order it was added? If not, what are the alternatives (I want to always execute EndScript in the end)