Code behind refers to code for your ASP.NET page that is contained within a separate class file. This allows a clean separation of your HTML from your presentation logic. The following sample illustrates an ASP.NET code behind page:
MyCodebehind.aspx
<%@ Language="C#" Inherits="MyStuff.MyClass" %>
<HTML>
<body>
<form id="MyForm" runat="server">
<asp:textbox id="MyTextBox" text="Hello World" runat="server"></asp:textbox>
<asp:button id="MyButton" text="Echo Input" Onclick="MyButton_Click" runat="server"></asp:button>
<asp:label id="MyLabel" runat="server" />
</form>
</body>
</HTML>
When you use Microsoft Visual Studio .NET to create ASP.NET Web Forms, code behind pages are the default method. In addition, Visual Studio .NET automatically performs precompilation for you when you build your solution. Note that code behind pages that are created in Visual Studio .NET include a special page attribute, Codebehind, which Visual Studio .NET uses.