Call C# method in javascript function directly

后端 未结 7 579
醉梦人生
醉梦人生 2021-01-21 02:10

How to call a c# method in javascript function directly. (eg page_load method of code behind page). Please help me.

相关标签:
7条回答
  • 2021-01-21 02:46

    You have multiple choices and each choice has its own pros and cons.

    • If you want to call page_Load event, just reload the page: window.location.reload() and the load event of your page will be called.
    • If you want to do it with Asynchronously, you have to use XMLHttpRequest (that is to use an Ajax library). You can use jQuery or Ajax.Net Professional or ASP.NET Ajax's update panel.
    0 讨论(0)
提交回复
热议问题