且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将客户端脚本注册到页面加载

更新时间:2023-12-05 15:01:40

从asp.net代码中注册javascript代码。



Register javascript code from asp.net code behind.

protected void Page_Load(object sender, EventArgs e)
{
     string js = "function test(){alert('hello')'}";
     ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "k1", js, true);
}