Calling c# code from javascript

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
 
J

John Timney \(Microsoft MVP\)

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>
 
A

Anita C

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.
 
J

John Timney \(Microsoft MVP\)

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>
----------------------------------------------
 
J

John Saunders

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,293
Latest member
Hue Tran

Latest Threads

Top