C# to JavaScript Communication - Function Calls

Add-in Express™ Support Service
That's what is more important than anything else

C# to JavaScript Communication - Function Calls
Running functions between JavaScript and C# 


If I wanted to run a JavaScript function from C# I can use window.execScript but..

How can I call a C# function from within JavaScript please?

<sc ript type="text/javascript" language="JavaScript">
control.runCsharpGet(this, "hello");
Posted 08 Feb, 2011 09:26:13 Top
Eugene Astafiev


Hi Rabbit,

Please have a look at the http://www.add-in-express.com/support/addin-c-sharp.php#internet-explorer sample add-in project.
Posted 08 Feb, 2011 09:30:19 Top


Thank you for your reply,

I can see the C# accessing the page and modifying the JS in the example, but I can't seem to see JavaScript directly calling/running any C# functions?

I have a C# function that saves a string it is passed in a text file, and another that gets the saved value from the text file, and I need to run these two C# functions from the JavaScript itself (for long term data storage).

I cant seem to find a command for this..

(I am working on a project without a toolbar or menu interaction).
Posted 08 Feb, 2011 09:59:38 Top


Edit: I am hoping to test the add-on I have been developing on an IE6 and IE7 machine once I can get this issue resolved, but I still can't find any leads on how to run a C# function from within JavaScript.

Please can someone help me urgently, I am quite stuck at the moment.
Posted 08 Feb, 2011 11:13:31 Top
Sergey Grischenko

Add-in Express team

Posts: 7233
Joined: 2004-07-05
Hi Rabbit,

Please look at the following example:
Posted 09 Feb, 2011 10:35:32 Top


That was exactly what I was looking for.

Thank you ever so much!
Posted 09 Feb, 2011 12:41:20 Top