473,569 Members | 2,562 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 1272
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 RegisterClientS cript.
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.RegisterCl ientScriptBlock ("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
1834
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 Control to call api routines from Javascript in the browser. Let's say I write up a game in python with my own functions. Then I embed it in a web...
9
2102
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 user to the JavaScript language, and focuses on creating user interactivity on personal websites. This Object Oriented Language is known for creating a...
6
1994
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 stands supports syntax highlighting and outlining of functions, classes and their methods.] When I took over the project in June it was for the...
18
4359
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 solution where and which part of the code should be placed/inserted in the main HTML code? Sometimes a Javascript functionality is split up to...
136
9251
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 code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to...
2
4056
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 language=JavaScript> function MyMouseOver() {
11
2767
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 < or several others, it converts them to html, such as &amp; or &lt; which can sometimes cause my scripts not to work. How can I prevent ASP.NET from...
1
25638
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 bad breath)? Scope describes the context in which a variable can be used. For example, if a variable's scope is a certain function, then that...
2
2498
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 seem very offensive to him. For over a year, Crockford has proposed an alternate way of using prototypes like this function object(o) { function...
23
2597
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 tutorial. The tutorial was complicated because showed me how to create a JavaScript Object that is a representation my .NET Object and how to get the two...
0
7701
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
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 we have to send another system
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.