简体   繁体   English

如何通过JavaScript调用C#服务器端方法

[英]How to call c# server side method through javascript

I need to call ac# server method through the javascript. 我需要通过javascript调用ac#服务器方法。 I have a gridview in which i have a column with dropdown list. 我有一个gridview,其中有一个带有下拉列表的列。 When i change the dropdown's value i need to call a server side method through javascript and change the value of another text box in the gridview. 当我更改下拉列表的值时,我需要通过javascript调用服务器端方法,并更改gridview中另一个文本框的值。

I am able to do this on the selected index change. 我可以在选定的索引更改上执行此操作。 but i am slightly worried about the performance. 但是我有点担心表现。

i am using asp.net c#. 我正在使用asp.net c#。

Please let me know how to do this. 请让我知道该怎么做。

Can also use PageMethods with ajax like here 也可以将PageMethods与Ajax结合使用,如下所示

http://aspalliance.com/1922_PageMethods_In_ASPNET_AJAX http://aspalliance.com/1922_PageMethods_In_ASPNET_AJAX

您将需要以类似于以下方式的方式使用AJAX: http : //www.codeproject.com/KB/aspnet/Ajax_Samplecode_in_C_Net.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM