当前位置:编程学习 > C#/ASP.NET >>

求救!!!ScriptManager.RegisterStartupScript在服务器无效

求救!!!请问各位遇到过这种情况没有?
if (txtSeachYear.Text == "")
 {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('年份不能为空')", true);
                
}

在本地服务器测试完全可以弹出提示信息,但是传到服务器上以后,就没反应,服务器是windows 2000系统 --------------------编程问答-------------------- if (string.IsNullOrEmpty(txtSeachYear.Text))
 {
  ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('年份不能为空');", true);
    
} --------------------编程问答-------------------- ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('年份不能为空')", true);
之前是不是有一个没有名称的执行了?就是第3个参数为空的ScriptManager.RegisterStartupScript --------------------编程问答-------------------- 第三个参数加上也不行,一样的 --------------------编程问答-------------------- 好像遇到过类似的问题!
改成false试试,如:
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "<script>alert('年份不能为空')</script>", false);
--------------------编程问答-------------------- alert()前后加上<script>、</script> --------------------编程问答-------------------- 好像遇到过类似的问题!
改成false试试,如:
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "<script>alert('年份不能为空')</script>", false);


这种方式也试了,本地行,一旦传到服务器上,还是不行,没反应,任何信息不提示 --------------------编程问答-------------------- 服务器的问题吧 --------------------编程问答-------------------- 终于解决问题了,郁闷的很,指定了一个UpdatePanel就对了,造孽 --------------------编程问答--------------------  ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('年份不能为空');", true);
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,