You can call C# functions through JavaScript, but not directly. That is to say, you just can't include the namespace and make a direct call to the function. The request has to go indirectly through an interface at the web server which handles browser requests and then sends them to the functions. There are several ways of doing this
- Using REST style services. I've been using this way ever since I shifted to ASP.NET MVC.
- Using Web services (Page Methods and Service Classes). Again Ajax is involved and there are special tools from Microsoft to make this easier.