日期:2014-05-17  浏览次数:20593 次

this.Page.ClientScript.RegisterClientScriptBlock问题
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script type=text/javascript >alert(货品类型名称不能为空!')</script>");
为什么不能弹出窗口呢?

------解决方案--------------------
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", " <script type=text/javascript >alert('货品类型名称不能为空!'); </script>"); 

你少了单引号了.最好加上分号.

------解决方案--------------------
if(!this.Page.ClientScript.IsRegisterClientScriptBlockered("alert"))
{
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", " <script language='javascript' >alert(货品类型名称不能为空!') </script>"); 
}