这种情况最典型的原因是单击按钮事件里有类似Response.Write这样的语句,由于ASP.NET
2.0默认采用http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd文档类型定义,它就要求在<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
的前面不能有任何输出。这种问题的解决方法是采用ClientScriptManager输出,或者采用Literal控件输出内容。

应该使用ScriptManager的方法

如果你在后台cs代码需要返回 alert的效果具体如下:Page.RegisterClientScriptStartupScript(GetType(),"b","alert('提示');",true);

相关文章:

  • 2021-12-13
  • 2022-12-23
  • 2022-03-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
猜你喜欢
  • 2021-05-29
  • 2021-08-01
  • 2021-08-20
  • 2021-12-17
  • 2022-12-23
  • 2021-04-11
  • 2021-11-12
相关资源
相似解决方案