日期:2014-05-18 浏览次数:20597 次
try { conn.Open(); int a = cmd.ExecuteNonQuery(); if (a == -1) { Response.Write("<script language=javascript>alert('添加失败');location='javascript:history.go(-1)'</script>"); } else { //Response.Write("<script language=javascript>alert('添加成功');</script>"); } } catch(Exception ex) { // Response.Write("<script language=javascript>alert('"+ex.ToString()+"');location='Test.aspx'</script>"); ScriptManager.RegisterStartupScript(udp1, typeof(UpdatePanel), "scriptname", "alert('" + ex.ToString() + "');", true); }
this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('测试输出!')", true);
------解决方案--------------------
updatepanel里不能用this.GetType(),这里的this是Page,没用的,要用control:
protected void DateTimePicker1_OnDateUpdated(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(DateTimePicker1, DateTimePicker1.GetType(), "abc", "alert('good');", true);
}
------解决方案--------------------
直接挂掉了 还弹什么?