开发者

How to c# function using javascript

I have input HTML button(Not ASP.NET Button) click event in c#

Is there any way i can cal开发者_运维知识库l c# function using javascript

Thank you very much....


Probably the easiest and most straightforward way will be to create an HTTPHandler on your ASP .NET site and then your JavaScript can make an AJAX call (easily done with jQuery, note the three links to three different methods, and there are likely more) to invoke that handler at its configured URL.

Additionally, does this method need to return anything? From the jQuery side your best bet will be to receive back a JSON object. This can be done pretty easily from the .NET side with the JavaScriptSerializer or even manually.


You need to use the MS Ajax JS libs. These will wire up things like that for you... but it has to be an ASP.NET button. Sounds like you want to make an AJAX Service call. Give us some more details as to how this is setup and how you want it to work. ASP.NET Forms is not very forgiving to simple buttons and JS... you need to think about viewstate.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜