1、UpdatePanel 使用中
protected void Button1_Click(object sender, EventArgs e)
{
this.Label1.Text = "测试时间:" + DateTime.Now.ToString();
ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(),"testalert", "<script>Test();</script>", false);
}
2、UpdatePanel 没有使用
protected void Button1_Click(object sender, EventArgs e)
{
this.Label1.Text = "测试时间:" + DateTime.Now.ToString();
ClientScriptManager cs = this.ClientScript;
cs.RegisterStartupScript(this.GetType(), "HelloWorld", "<script>alert('test alert');</script>");
}
源代码下载:https://files.cnblogs.com/tianjinquan/WebReportJS.zip