且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在updatepanel中显示clientscript

更新时间:2023-12-05 23:07:58

当您使用更新面板时,您无法像上面那样调用javascript。你必须使用

 ScriptManager.RegisterStartupScript 



只需更改你的

ClientScript.RegisterStartupScript(this.GetType(),,alert('无法删除'),true);





 ScriptManager.RegisterStartupScript(updatePanelId,updatePanelId.GetType()
,('无法删除'),javaScript,true);


hi i want tp display javascript alert message in .cs file here is my script ClientScript.RegisterStartupScript(this.GetType(), "", "alert(''Cannot Delete'')", true);
uplcityDetail.update()//update panel id

in .cs file but code is executeing alert is not displaying can any tell me please

When you use update panel then you can not call javascript like above. You have to use
ScriptManager.RegisterStartupScript


Just change your

ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Cannot Delete')", true);


to

ScriptManager.RegisterStartupScript(updatePanelId,updatePanelId.GetType()
                                   ,"('Cannot Delete')", javaScript, true);