Calling C# method from a JavaScript program
-
I can call JavaScript functions from my C# dll, but I was hoping I could send information via function calls from the javascript back to me C# dll. I can not find anyway to do this. Please let me know where this information would be at in this great web of ours. Thanks :confused:
Programmer Glenn Earl Graham Manning NavComp Austin, TX
-
I can call JavaScript functions from my C# dll, but I was hoping I could send information via function calls from the javascript back to me C# dll. I can not find anyway to do this. Please let me know where this information would be at in this great web of ours. Thanks :confused:
Programmer Glenn Earl Graham Manning NavComp Austin, TX
Hello You can call C# functions from javascript using XMLHTTP calls ...I think you can use Mschwarz ajax library( http://weblogs.asp.net/mschwarz/ )
Cheers Navaneeth!!
-
I can call JavaScript functions from my C# dll, but I was hoping I could send information via function calls from the javascript back to me C# dll. I can not find anyway to do this. Please let me know where this information would be at in this great web of ours. Thanks :confused:
Programmer Glenn Earl Graham Manning NavComp Austin, TX
As has already been suggested, you can use AJAX, but if you just want to post back user input, you can also just set the value of hidden fields using your javascript code. Just register a hidden field in your form by some name that will be known both in your javascript and your server side C# code. Then have javascript obtain that field by using document.getElementById and set its value to whatever you want. Then, when the page gets posted back, you will have access to the value that was placed in that field. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
-
As has already been suggested, you can use AJAX, but if you just want to post back user input, you can also just set the value of hidden fields using your javascript code. Just register a hidden field in your form by some name that will be known both in your javascript and your server side C# code. Then have javascript obtain that field by using document.getElementById and set its value to whatever you want. Then, when the page gets posted back, you will have access to the value that was placed in that field. -Matt
------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
It works like a champ! Thanks of the info. :-D
Programmer Glenn Earl Graham Austin, TX