How to Add script codes before the </body> tag ASP.NET

后端 未结 3 1905
遥遥无期
遥遥无期 2021-01-27 02:17

Heres the problem,

In Masterpage, the google analytics code were pasted before the end of body tag.

In ASPX page, I need to generate a script (goo

相关标签:
3条回答
  • 2021-01-27 03:12

    You could delay your script execution until after the page loads, then it won't matter where your script resides.

    0 讨论(0)
  • 2021-01-27 03:15

    An inelegant but simple approach, if you're able to avoid using ClientScript, would be to just stick a literal in the page where you want your script to be rendered and put the script in there from your codebehind (i.e. myLiteral.Text = "client script";).

    0 讨论(0)
  • 2021-01-27 03:17

    Take a look at RegisterStartupScript

    The script block will be placed right above the </form> tag at the end of the page.

    0 讨论(0)
提交回复
热议问题