Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / January 2007

Tip: Looking for answers? Try searching our database.

communication between JScript and C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bowser - 11 Jan 2007 11:13 GMT
Hello,
I have a problem of communication between JScript and C#. I must say
that I'm new to both.
In a JS file I have to call a C# function.
In particular I have:

public function Eval(expr : String) : String
{
 return eval(expr);
}

And I want to call:

Eval("MyNS.myFunction()");

where myFunction is declared in a C# file, under the namespace MyNS,
and returns a string.

Is it possible to do such a thing without to consider COM objects
(which I've heard to be used in similar problems)?

Note that the .js file is generated dinamically by a CodeDomProvider in
C#.
It is compiled by adding the reference of the .exe file, which contains
myfunction():
parameters.ReferencedAssemblies.Add("MyApp.exe");
So the call Eval("MyNS.myFunction()"); will be done with Reflection

One more question: is there another way to use the jscript function
eval in C#? Maybe compiling a .js module (not dinamically and not using
reflection) that can be used by a C# module?

Thank you.

Alessandro
Brian Williams - 15 Jan 2007 16:59 GMT
You will need to use AJAX, ASP.Net AJAX, or Remote Scripting to call server
methods from client side.
I would use ASP.Net AJAX.

http://ajax.asp.net/ (ASP.Net AJAX)
http://www.codeproject.com/aspnet/AlvaroRemoteScripting.asp
http://developers.sun.com/ajax/index.jsp?cid=59754

Regards,
Brian K. Williams

> Hello,
> I have a problem of communication between JScript and C#. I must say
[quoted text clipped - 31 lines]
>
> Alessandro

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.