Add custom script to ScriptManager?

I love how in ASP.NET the ScriptManager has a composite section which allows one to specify multiple javascript files and it does the legwork of merging them all into one file at runtime.


//input scriptB.js, scriptB.js
ScriptManager.CompositeScript.Scripts.Add("~/scriptA.js")//psuedo code
ScriptManager.CompositeScript.Scripts.Add("~/scriptB.js")//psuedo code

Is it possible to add javascript source directly to the scriptmanager, E.G.:

ScriptManager.CompositeScript.Scripts.Add("alert('hello');")//psuedo code



You could add script through ScriptManager like this:

ScriptManager.RegisterStartupScript(this, GetType(), ClientID,"alert('hello');", true);

This script will be added directly to page.


It works for me when I do it like this

Private Sub test()
        ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "k1", "alert('hello')", True)
    End Sub

but when I add SweerAlert to it it wont work

Private Sub test()
            ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "k1", "swal('Please Provide All Valid Message Information!')", True)
        End Sub

do you have any idea why it dont works.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.