J
Josh Mitts
Hi,
Do you mean a class in a code-behind file? The method is slightly different
in ASP.NET 2.0 than in 1.1. If you are using ASP.NET 1.1, you need to
compile your code-behind file into a class, place the compiled .dll in the
bin directory, and have your page inherit from that class using the
following syntax:
<%@ Page Language="C#" CodeBehind="MyPage.aspx.cs" Inherits="MyPage" %>
(note the CodeBehind setting is optional, and merely gives the compiler a
location for your source, helps out visual designers, etc.).
However, a tool like Visual Studio will set up this two-file system,
compilation, page directive, etc. automatically for you.
On the other hand, if you are using ASP.NET 2.0, you only need to place the
..cs file alongside the .aspx file and use the following syntax -- ASP.NET
will compile it automatically:
<%@ Page Language="C#" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>
Do you mean a class in a code-behind file? The method is slightly different
in ASP.NET 2.0 than in 1.1. If you are using ASP.NET 1.1, you need to
compile your code-behind file into a class, place the compiled .dll in the
bin directory, and have your page inherit from that class using the
following syntax:
<%@ Page Language="C#" CodeBehind="MyPage.aspx.cs" Inherits="MyPage" %>
(note the CodeBehind setting is optional, and merely gives the compiler a
location for your source, helps out visual designers, etc.).
However, a tool like Visual Studio will set up this two-file system,
compilation, page directive, etc. automatically for you.
On the other hand, if you are using ASP.NET 2.0, you only need to place the
..cs file alongside the .aspx file and use the following syntax -- ASP.NET
will compile it automatically:
<%@ Page Language="C#" CodeFile="MyPage.aspx.cs" Inherits="MyPage" %>