当前位置: 代码迷 >> ASP.NET >> Page.ClientScript.RegisterClientScriptBlock没有反应解决方案
  详细解决方案

Page.ClientScript.RegisterClientScriptBlock没有反应解决方案

热度:6347   发布时间:2013-02-25 00:00:00.0
Page.ClientScript.RegisterClientScriptBlock没有反应
protected   void   Page_Load(object   sender,   EventArgs   e)
{
      string   myScript   =   @ "function   AlertHello(){alert( 'Hello   ASP.NET ');} ";
      Page.ClientScript.RegisterClientScriptBlock(this.GetType(),   "MyScript ",   myScript,   true);  
}

执行这段代码,没有任何反应,看看那里有问题?怎么才能弹出对话框?

------解决方案--------------------------------------------------------
string myScript = @ "window.onload = function AlertHello(){alert( 'Hello ASP.NET ');} ";

-->

string myScript = @ " <script> window.onload = function AlertHello(){alert( 'Hello ASP.NET ');} </script> ";
  相关解决方案