I use ScriptManager.RegisterStartupScriptto 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 HTML is displayed, it adds them in order.
<script type="text/javascript">
//<![CDATA[
other functions calls..
SomeScript1();SomeScript2();EndScript();
//]]>
</script>
However, when I go into debug mode, the script execution is out of order (Ex: EndScriptruns earlier than SomeScript1or SomeScript2)
Is ScriptManager.RegisterStartupScriptgaurantee running in the order in which it was added? If not, what are the alternatives (I want to always execute EndScriptat the end)
source
share