473,395 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Using C# script instead of JavaScript problems

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()
{
alert("We are there!");
}
</SCRIPT>

<H3>Walk over <A onmouseover=MyMouseOver() ref="http://msdn.microsoft.com"
ME!</A></H3>

1- How can I change the script to C# using <script language=C#
runat="server">

Changing the script in the following manner doesn't work:

<SCRIPT language=C# runat="server">
void MyMouseOver()
{
// Do something
}
</SCRIPT>

2- Can I call server side functions from within JavaScript functions?

Thanks !!!

Jeronimo
Nov 18 '05 #1
2 4048
1. The onMouseOver and onMouseOut events are client only functions. You
can't implement those using javascript (well, you could, but it would be a
waste of time and resources. You'd have to implement still more javascript
to do the postback on the mouse over event, which would be quite useless).

2. You cannot call server side functions from a client side script unless
you're posting back the form, which again, is fruitless if you're trying to
manipulate something on the client end. Stick with Javascript.

ASP.NET (including C#, or any other .NET language) is a server side
programming language. You cannot manipulate client side properties using
them, because server side code only gets executed once during a page's life
cycle (the actual request from the server).

Hope this helps...

I was minding my own business when Jeronimo Bertran blurted out:
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()
{
alert("We are there!");
}
</SCRIPT>

<H3>Walk over <A onmouseover=MyMouseOver() ref="http://msdn.microsoft.com"
ME!</A></H3>

1- How can I change the script to C# using <script language=C#
runat="server">

Changing the script in the following manner doesn't work:

<SCRIPT language=C# runat="server">
void MyMouseOver()
{
// Do something
}
</SCRIPT>

2- Can I call server side functions from within JavaScript functions?

Thanks !!!

Jeronimo


--
Insert corny line here
Nov 18 '05 #2
I was minding my own business when -=Chris=- blurted out:
1. The onMouseOver and onMouseOut events are client only functions. You
can't implement those using javascript
[Correction: You can't implement those using C#]

(well, you could, but it would be a waste of time and resources. You'd have to implement still more javascript to do the postback on the mouse over event, which would be quite useless).

2. You cannot call server side functions from a client side script unless
you're posting back the form, which again, is fruitless if you're trying to manipulate something on the client end. Stick with Javascript.

ASP.NET (including C#, or any other .NET language) is a server side
programming language. You cannot manipulate client side properties using
them, because server side code only gets executed once during a page's life cycle (the actual request from the server).

Hope this helps...

I was minding my own business when Jeronimo Bertran blurted out:
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()
{
alert("We are there!");
}
</SCRIPT>

<H3>Walk over <A onmouseover=MyMouseOver() ref="http://msdn.microsoft.com" ME!</A></H3>

1- How can I change the script to C# using <script language=C#
runat="server">

Changing the script in the following manner doesn't work:

<SCRIPT language=C# runat="server">
void MyMouseOver()
{
// Do something
}
</SCRIPT>

2- Can I call server side functions from within JavaScript functions?

Thanks !!!

Jeronimo


--
Insert corny line here
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Maria Bitsku | last post by:
How do I deactivate a window using Javascript. For example if I have a window that opens up another window, how do I prevent the user from clicking (doing anything) in the original window until...
3
by: Russell | last post by:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull. I have a modal dialog that is an IFrame. The IFrame contains another window - which contains the appropriate...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
13
by: nobody | last post by:
Hello all, I've searched just about everything and although I can see that other people are having problems, but theirs don't seem to relate, so in a last ditch attempt, my posting! Script...
6
by: abdullah1983 | last post by:
Hi Guys, I need some clarification regarding the problem with safari browser. Please find my code below. I'm setting the image src, mouseover and mouseout using javascript. The mouseover and...
21
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript"...
8
by: otto | last post by:
Hi, all: I have a problem with the inclusion of .js files in mu .aspx pages when using Master Pages. I try to explain it. If I make a web project without master pages I simply put in the head...
9
by: whitgurley | last post by:
I've searched the web as well as I can for a solution to this problem but have found nothing and just don't know enough about JavaScript to figure out what's going. What I'm trying to do is convert...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.