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>");
}
时间: 2024-11-05 23:32:18