弹出错误“需要对象引用". [英] popup error "object reference is required"

查看:111
本文介绍了弹出错误“需要对象引用".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


下面是我的显示弹出窗口的代码

Hi
Below is my code to display a popup

Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "script", "alert(''Record Successfuly saved'');", true);



我收到错误消息"



i am getting a error "

Error   12  An object reference is required for the non-static field, method, or property 'System.Web.UI.Page.ClientScript.get' 



你能指导怎么做吗?


谢谢



could you please guide what to do?


Thanks

推荐答案



试试这个而不是上面的...
Hi,

Try this instead of above...
Page.ClientScript.RegisterStartupScript(GetType(), "script","alert('Record Successfuly saved');", true);



高兴的是,如果有帮助,别忘了投票...

问候



Pleased don''t forget to vote if help...

Regards,


请尝试以下操作:

http://madskristensen.net/post/JavaScript-AlertShow%28e2809dmessagee2809d% 29-from-ASPNET-code-behind.aspx [ ^ ]

http://www.karpach.com/Javascript-Alert-Message-codebehind-ASP- NET.htm [ ^ ]
Try the following:

http://madskristensen.net/post/JavaScript-AlertShow%28e2809dmessagee2809d%29-from-ASPNET-code-behind.aspx[^]

http://www.karpach.com/Javascript-Alert-Message-codebehind-ASP-NET.htm[^]


将其替换为

replace this with

Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "script", "alert(''Record Successfuly saved'');", true);



这个



this

Page.ClientScript.RegisterStartupScript(this.GetType(), "aa", "<script language=''javascript''>alert(''Record Successfuly saved'');</script>");


这篇关于弹出错误“需要对象引用".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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