我们如何从javascript调用c#方法,该方法不应该是静态方法 [英] How can we make a call to c# method from javascript, that method should not be static method

查看:39
本文介绍了我们如何从javascript调用c#方法,该方法不应该是静态方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,来自锚标记我在点击事件上调用一个方法。下面是我的代码,





Hi All, from anchor tag im calling a method on click event. below is my code,


<a class=""  href="java<!-- no -->script:void(0);" runat="server" id="idSave" title="SAVE" >
				<span>
					<img class="" src="/_imgs/Tools/save_16.png" />
                
					<div class="" >SAVE</div>
				</span>
			</a>





Javascript方法是





Javascript Method is

function Save() {
					__doPostBack('idSave', '');
				}





从上面的javascript方法我需要调用c#方法,该方法不应该是静态方法。



非常感谢

Sanjeev



From the above javascript method i needed to make a call to c# method, that method should not be static method.

Many thanks
Sanjeev

推荐答案

你可以用 PageMethods [ ^ ]。请看下面的链接:



http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/calling-an-Asp-Net-C-Sharp-method-web-method -using-javascript / [ ^ ]



http://stackoverflow.com/questions/10658061/calling-asp-net-page-method-from-javascript-不工作 [ ^ ]
You can use PageMethods[^]. Look at the links below:

http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/calling-an-Asp-Net-C-Sharp-method-web-method-using-javascript/[^]

http://stackoverflow.com/questions/10658061/calling-asp-net-page-method-from-javascript-not-working[^]


这篇关于我们如何从javascript调用c#方法,该方法不应该是静态方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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