I have Default.aspx and Default.aspx.cs files. Default.aspx.cs contains partial class and is unable to access the objects in the Default.aspx.
Here is the Default.aspx file.
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="SimplePage.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>First Page Code-Behind</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button
id="Button1"
Text="Click Here"
OnClick="Button1_Click"
Runat="server" />
<br /><br />
<asp:Label
id="Label1"
Runat="server" />
</div>
</form>
</body>
</html>
I am getting the following error when I compile. Here is the error.
The name 'Label1' does not exist in the current context (CS0103) - C:\CSExample\SimplePage\SimplePage\Default.aspx.cs:33,5