I’m trying to call a JavaScript function from Code behind but no luck so far. I tried to add the following snippets inside Page_Load
method.
I’ve tried as below
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "foo", "alert('test22222')", true);
Also as below
Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript", "alert('test22222');", true);
None worked for me. Is there anything I’m missing here? I would like to show the alert message before loading the page.
Any help appreciated. Thanks.