Call C# function in javascript

PagodNaUtak used Ask the Experts™
How can you call a C# function in javascript
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Engineer
Top Expert 2009
Use page methods, check:

basically your C# fucntion is a web method.

U can use web methods..I will show u an example.
(Below function will written in codebehind)
public static string MyMethod(string name)
    return "Hai " + name;

You can call this MyMethod in javascript like this.

    function test(){
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Miguel OzSenior Software Engineer
Top Expert 2009

vivekpv10, I already suggested pageMethods in my previous comment and the posted link already contained a sample. Thanks
Hai mas_oz2003:This question  is not logical one.The question having only one WebMethods.So i posted that answer.I explained that with a simple example and also with a link that also providing code sample.I think i done nothing wrong with that.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial