I have an external js file that is basically a js object. I am using the ScriptManager.RegisterClientScriptInclude method to include the file on page, and after that I am using the ScriptManager.RegisterClientScriptBlock method to call a method of the js object, but am getting a js error of 'DynamicLoadingPanel is not defined'. I know the method call works when I have it in the aspx page, but I think I'm getting the error cause of the timing when the ScriptManager registers the script block. I currently have the Registers in the Page_Load event, below is my code. Can someone please help me understand what's going on here. Thanks.
Page_Load Event
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.ClientScript.IsClientScriptIncludeRegistered("DynamicLoadingPanel"))
{
ScriptManager.RegisterClientScriptInclude(Page, typeof(Page), "DynamicLoadingPanel", "~/dynamicLoadingPanel.js");
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "set_LoadingPanelID", "DynamicLoadingPanel.set_loadingPanelID('modalLayer');", true);
}
}