如何在updatepanel中显示clientscript [英] how to display clientscript in updatepanel

查看:88
本文介绍了如何在updatepanel中显示clientscript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我想在.cs文件中显示javascript警告消息这里是我的脚本ClientScript.RegisterStartupScript(this.GetType(),,alert(''无法删除''),true);

uplcityDetail.update()//更新面板ID



in .cs文件但代码执行警报未显示可以告诉我请

解决方案

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

 ScriptManager.RegisterStartupScript 



只需更改你的

< pre lang =xml> 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);


这篇关于如何在updatepanel中显示clientscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆