开发者

Calling an ASP.Net function from javascript

开发者 https://www.devze.com 2023-01-22 12:45 出处:网络
Is it possible to call a C# function in开发者_JS百科 my codebehind from javascript?Yes, you could use PageMethods.

Is it possible to call a C# function in开发者_JS百科 my codebehind from javascript?


Yes, you could use PageMethods.


You cannot call server-side code ‘directly’ from client-side code. That is because by design, the server side code executes at server side and client side code at the client. However there are some workarounds. To call serverside code from javascript, you will need to use AJAX, and the easiest way out, is to use the ASP.NET AJAX Extensions.

Check this link

How to call Server Side function from Client Side Code using PageMethods in ASP.NET AJAX

0

精彩评论

暂无评论...
验证码 换一张
取 消