S
SAI
I have 2 files which are copied from Microsoft for testing code behind.
But always show error "Parser Error Message: Could not load type 'MyClass'."
and highlight the aspx file code, Is my server has problem? thx.
Line 1: <%@ Page Language="C#" Inherits="MyClass" %>
aspx file content :
<%@ Page Language="C#" Inherits="MyClass" %>
<html>
<head>
</head>
<body>
<form id="MyForm" runat="server">
<asp:textbox id="MyTextBox" runat="server" text="Hello
World"></asp:textbox>
<asp:button id="MyButton" onclick="MyButton_Click" runat="server"
text="Echo Input"></asp:button>
<asp:Label id="MyLabel" runat="server"></asp:Label>
</form>
</body>
</html>
cs file content :
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyStuff
{
public class MyClass : Page
{
protected System.Web.UI.WebControls.Label MyLabel;
protected System.Web.UI.WebControls.Button MyButton;
protected System.Web.UI.WebControls.TextBox MyTextBox;
public void MyButton_Click(Object sender, EventArgs e)
{
MyLabel.Text = MyTextBox.Text.ToString();
}
}
}
But always show error "Parser Error Message: Could not load type 'MyClass'."
and highlight the aspx file code, Is my server has problem? thx.
Line 1: <%@ Page Language="C#" Inherits="MyClass" %>
aspx file content :
<%@ Page Language="C#" Inherits="MyClass" %>
<html>
<head>
</head>
<body>
<form id="MyForm" runat="server">
<asp:textbox id="MyTextBox" runat="server" text="Hello
World"></asp:textbox>
<asp:button id="MyButton" onclick="MyButton_Click" runat="server"
text="Echo Input"></asp:button>
<asp:Label id="MyLabel" runat="server"></asp:Label>
</form>
</body>
</html>
cs file content :
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyStuff
{
public class MyClass : Page
{
protected System.Web.UI.WebControls.Label MyLabel;
protected System.Web.UI.WebControls.Button MyButton;
protected System.Web.UI.WebControls.TextBox MyTextBox;
public void MyButton_Click(Object sender, EventArgs e)
{
MyLabel.Text = MyTextBox.Text.ToString();
}
}
}