Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • J 445 posts 862 karma points
    Dec 10, 2019 @ 16:39
    J
    0

    How to call Javascript from web control?

    I have an empty template under Templates (so i know its clean and no inheritance from any parent template etc). Within this template i have added just one macro. This is a web control. To the page load event i type

    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "<script type=\"text/javascript\">alert('Test');</script>", true);
    

    And it didnt work.

    I type

    Response.Write("<script type=\"text/javascript\">alert('TEST');</script>");
    

    and see the alert. Why does this happen? How could i run some Javascript on page load? I have another Javascript to run so this is to use basic code to get things working before attempting the correct JS to run.

Please Sign in or register to post replies

Write your reply to:

Draft