473,503 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript Functions And C#.NET

12 New Member
hi friends,


I think u can help me!!!!!!!!

How we can access a javascript function from a C#code file(.csFile)
and how we ca access a C# function from Javascript..........


*****Nice Pgmg***********************

Sree
Mar 12 '08 #1
4 1267
indianmaestro
16 New Member
java in c#

return getconfirm();

getconferm is a function written in javascript, u call call that where ever necessary.. like in button click.........

c# code in java
sisplaymenu is a function written in c# and it is called in html
<%DisplayMenu();%>

hope this will help u
Mar 12 '08 #2
saran23
28 New Member
hi friends,


I think u can help me!!!!!!!!

How we can access a javascript function from a C#code file(.csFile)
and how we ca access a C# function from Javascript..........


*****Nice Pgmg***********************

Sree
Hi u can make use of a string and write the javascript inside it and call the string in Response.Write.
The other way is RegisterClientScript.
It would be better to use the second one, for that u hv to learn it from any site.or MSDN
Mar 12 '08 #3
ShahbazAshraf
36 New Member
Use this

Page.RegisterClientScriptBlock("Key","<script> functionname() </script>");
Mar 12 '08 #4
Frinavale
9,735 Recognized Expert Moderator Expert
hi friends,


I think u can help me!!!!!!!!

How we can access a javascript function from a C#code file(.csFile)
and how we ca access a C# function from Javascript..........


*****Nice Pgmg***********************

Sree
JavaScript runs on the client's side...in their browser and the C# code runs on the server...

You cannot access a C# function using simple JavaScript.
You could insert some Ajax that will asynchronously post back to the server and call the C# function.

Likewise you cannot access a JavaScript function from C#.
You could put in a HiddenField that enables you to share data between your JavaScript and C# code.

Eg: Your JavaScript does some calculations and sets the value of the hidden field with it's results, the C# code can then retrieve the data from the hidden field and do further Server Side processing on the data.

You can generate JavaScript using C# code (as has already been suggested by the other posters); but, you cannot call JavaScript functions from C# code.

You can asynchronously call the C# functions using Ajax (not simple JavaScript)

Cheers!
-Frinny
Mar 12 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1829
by: whimsica | last post by:
I'm investingating a c++ api, Panda3d.com, that has a python binding. I want to convert this api into an ACtiveX control so it will run on the web. When I do so I want to use Microsoft Script...
9
2095
by: Charlene Russ | last post by:
Learn on-line at your own in a user-centered format with plenty of interaction and personal attention. This is a basic level coursed designed to introduce the novice to intermediate computer...
6
1983
by: Alex Fitzpatrick | last post by:
Just by way of introduction, I'm currently the principal developer and maintainer of the a JavaScript editor plug-in for Eclipse. https://sourceforge.net/projects/jseditor/ The plug-in as it...
18
4345
by: Arthur Connor | last post by:
Is there a way of extracting the Javascript code from the "normal" HTML code (e.g. similar to CSS code which can be put into a separate file) ? If you offer a solution: can I determine in your...
136
9201
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
2
4054
by: Jeronimo Bertran | last post by:
A couple of questions I am having problems with converting my JavaScript to C#. I have the following code using JavaScript for the mouseover handler that works fine: <SCRIPT...
11
2758
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
1
25620
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
2
2484
by: Peter Michaux | last post by:
Douglas Crockford doesn't seem to like JavaScript's built-in syntax for building new objects based on a prototype object. The constructor function, its prototype property and the "new" keyword all...
23
2577
Frinavale
by: Frinavale | last post by:
JavaScript is a very strange place for me... So, I decided that, before I attempt to create an Object, I should first learn about Objects. I had actually created one before with the help of a...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.