Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the js script for background registration in ASP.NET

Shulou Source: shulou.com Published: 2022-06-03 06:45:08 11月15日 Update

This article mainly introduces the ASP.NET background registration js script how to use, the article introduces in great detail, has a certain reference value, interested friends must read it!

Use Page.ClientScript.RegisterClientScriptBlock and Page.ClientScript.RegisterStartupScript: the difference:

1. Use Page.ClientScript.RegisterClientScriptBlock

C # code

The copy code is as follows:

Protected void Page_Load (object sender, EventArgs e)

{

String myScript = @ "function AlertHello () {alert ('Hello ASP.NET');}"

Page.ClientScript.RegisterClientScriptBlock (this.GetType ()

"MyScript", myScript, true)

}

The running results are as follows:

The copy code is as follows:

Adding JavaScript

Tags: Code method page run background script content bottom file article censor different maximum value interest reason guys buddies developers more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Technology NVidia OPPO Reno Huawei