如何使用asp.net在aspx.cs中编写javascript代码 [英] how to write javascript code in aspx.cs using asp.net

查看:104
本文介绍了如何使用asp.net在aspx.cs中编写javascript代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用asp.net在aspx.cs中编写JavaScript代码...?
请帮助

谢谢

how to write javascript code in aspx.cs using asp.net...?
Please Help

Thanks

推荐答案

我认为您需要这些功能: RegisterClientScriptBlock RegisterStartupScript

在以下位置了解更多信息:
http://msdn.microsoft.com/en-us/library/aa478975.aspx [ ^ ]
I think you need these functions : RegisterClientScriptBlock and RegisterStartupScript

read more at :
http://msdn.microsoft.com/en-us/library/aa478975.aspx[^]


检查以下链接.

http://madskristensen.net/post/JavaScript-AlertShow(e2809dmessagee2809d)- from-ASPNET-code-behind.aspx [
Check the below link.

http://madskristensen.net/post/JavaScript-AlertShow(e2809dmessagee2809d)-from-ASPNET-code-behind.aspx[^]


您可以通过以下方法调用任何javascript函数:-

You can call any javascript function by this :-

ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "whatever", "ShowGridViewColumn();", true);



或者您也可以像这样在这里写它:-



or you can write it here also like this :-

ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "whatever", "alert('Hello');", true);


这篇关于如何使用asp.net在aspx.cs中编写javascript代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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