javascriptasp.nettwitter-bootstrapscriptmanager

ASP.NET Bootstrap show modal while loading JS files at the end of body tag


I am trying to show a bootstrap modal programmatically using ASP.NET.

The problem is that the ScriptManager is before the script loading (I loads the script files at the end of the body). Because of that the ScriptManager code doesn't affect the modal.

This is any way to bypass it without moving the JS files to the head?

Thanks


Solution

  • So, I found out how to run it even without jquery is loaded.

    At the <head> tag I added:

    <script>
        function showModal() {
            $('#myModal').modal('show');
        }
    </script>
    

    And in the server side all I have had to do was to call:

    ScriptManager.RegisterStartupScript(this, this.GetType(), "myModal", "window.onload = showModal;", true);
    

    So now it will run even calling it before any js file is loaded.