用C#代码执行Java脚本功能 [英] execute java script function in C# code
本文介绍了用C#代码执行Java脚本功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Java脚本函数,该函数返回一些值.我有linkbutton_Click事件.当我单击链接按钮时,我需要执行第一个Java脚本功能,并且必须从中获取价值并执行C#代码.
请使用简单示例给出解决方案
I have a java script function which returns some value. and i have linkbutton_Click event. when i click on link Button i need to execute first java script function and must take value from it and execute C# code.
please give a solution with simple example
推荐答案
JavaScript调用服务器端方法的唯一方法是使用带外技术,例如PageMethod. http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx [
The only way for the JavaScript to call a server-side method is to use out of band techniques, such as a PageMethod. http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx[^]
如Mark所述,您需要使用Page ASP.Net C#中的方法机制.
检查一下:
http://aspalliance.com/1922_PageMethods_In_ASPNET_AJAX.all [
As Mark mentioned you need to use Page Methods mechanism in ASP.Net C#.
Check this out:
http://aspalliance.com/1922_PageMethods_In_ASPNET_AJAX.all[^]
hope it helps :)
这篇关于用C#代码执行Java脚本功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文