HI'),但不工作:UserControl:ASP.NETpageprotectedvoidbtnSubmit_Click(objectsender,EventArgse){ScriptManager.RegisterStartupScript(this,this.GetType(),"s1","javascript:alert('hi!')“,真的);}更新:忘记说ASP.NET页面本身是一个“prettyPhoto”弹出窗口。可能有以下几种可能的原因试试改这些看看是否有效以上是C#学习教程:如何通过事件从UserControl背后的代码激活JS所有内容分享,如果对大家有用需要进一步了解C#学习教程,希望大家多多关注——1)。ScriptManager.RegisterStartupScript(this,this.GetType(),"msg","alert('hi!')",true);//bool设置为true时不需要使用javascriptwithalert2).ScriptManager.RegisterStartupScript(page,page.GetType(),"msg","alert('hi!')",true);3).ClientScript.RegisterClientScriptBlock(GetType(),"sas","",true);本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
