Question: Could you please tell me if I can call a C# event or method from javascript code in an ASP.NET web application?

Answer: 
You cannot directly execute a C# Event or Method. You can hit an endpoint via AJAX. This could be an ASP.NET MVC Controller or an .ashx handler.

Alternatively you can look at implementing something like SignalR, which via its Hubs, allows you to do magical things from javascript (and from the server, push notifications and things of that sort.)
Yes one can call `C# Method` from `javascript` using `ajax` in `asp.net webforms` also can do that in `asp.net MVC`

for example here is `web forms` example 

```
    <script type="text/javascript">
    $(document).ready(function () {

     $.ajax({
         type: "POST",
         url: "Default.aspx/GetData",
         contentType: "application/json; charset=utf-8",
         dataType: "json",
         success: function (response) {
             alert(response.d);
         },
         failure: function (response) {
             alert(response.d);
         }
     });
 });
</script>

```

and new code behind `c# method`

```
[WebMethod]
public static string GetData()
{
    return "This string is from Code behind";
}

```

Output looks like this 
[![enter image description here](https://i.stack.imgur.com/027xg.png)](https://i.stack.imgur.com/027xg.png)
[![enter image description here](https://i.stack.imgur.com/AeuY2.png)](https://i.stack.imgur.com/AeuY2.png)