Calling c# code from javascript

  • Thread starter Thread starter Anita C
  • Start date Start date
A

Anita C

Hi,
Can one call a c# function from within a javascript function ? I have a c#
function GetLanguageItem(title), how can I call the above function from a
javascript function in an .aspx page.
Thanks
 
You might be able to do what you want with Web Service behaviours, but it
will be IE only

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
Yes the code is running on the client's browser.

John Saunders said:
Is the JavaScript function running on the client's browser? If so, it cannot
directly call a function running on the server.
 
start here

http://www.webreference.com/js/column97/

read this

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/webservic
e/overview.asp

and see this example

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/webservic
e/webservice.asp

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------
 
Dejan said:
Hi,

I solve this problem by Response.Write("<Script>");
and within this you call you java script GetLanguageItem(title)
I hope this solves your problem.

Dejan,

That doesn't work if "GetLanguageItem" is a server-side function.
 
Back
Top