469,623 Members | 1,457 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

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 3926
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Maria Bitsku | last post: by
13 posts views Thread by Stumped and Confused | last post: by
6 posts views Thread by abdullah1983 | last post: by
21 posts views Thread by hemant.singh | last post: by
8 posts views Thread by otto | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.