joe_pool_is
Contributor
I wrote some code in C#:
...but this gives me an error in Internet Explorer, saying "Error: 'myAction' is undefined". When I select "View Source", obviously the C# script is not displayed.
How can I allow my C# code to be accessed by the form? Does anyone even understand what I am trying to ask? Is this possible in ASP.NET/C# ... or whatever you want to call it.
Code:
<%@ Page Language="C#" %>
<script runat="server">
void myAction(Object Sender, EventArgs e) {
if (Sender.Equals("theBody")) {
testArea.InnerHtml = "The body works.";
} else
if (Sender.Equals("myLink")) {
testArea.InnerHtml = "The link works.";
}
}
</script>
<html>
<head>
</head>
<body id="theBody" onload="myAction" runat="server">
<asp:Hyperlink id="myLink" onmouseover="myAction" runat="server" NavigateUrl="" Text="Test" />
<span id="testArea" runat="server" />
</body>
</html>
How can I allow my C# code to be accessed by the form? Does anyone even understand what I am trying to ask? Is this possible in ASP.NET/C# ... or whatever you want to call it.