|
-
Oct 6th, 2003, 11:35 AM
#1
Thread Starter
Frenzied Member
ASP.NET Code Behind C#
I've learning ASP.NET using c# at present. I've got an example of using code behind but its not working can anyone point out why its not working?
myCodeBehind.cs:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public class myCodeBehind: Page {
protected Label lblMessage;
protected void Button_Click(Object sender , EventArgs e) {
lblMessage.Text="Hello World!!";
}
}
Presentation.aspx
<%@ Page codebehind="myCodeBehind.cs" Inherits="myCodeBehind" Language="C#" %>
<html>
<head><title>Presentation.aspx</title></head>
<body>
<form Runat="Server">
<asp:Button
Text="Click Here!"
OnClick="Button_Click"
Runat="Server" />
<p>
<asp:Label
ID="lblMessage"
Runat="Server" />
</form>
</body>
</html>
There is a parser error - cannot find myCodeBehind. So the first line of the aspx file is at fault - but what is wrong?
Any ideas?
DJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|