Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Visual Studio.NET implements CodeBehind by precompiling the base class, then uses the Inherits keyword to refer to that class.
<%@ Page language="C#" Inherits="MyBlog.HelloWorld" Codebehind="HelloWorld.aspx.cs" %>
According to the .NET documentation, the Src attribute of the Page directive specifies the source file name of the code-behind class to dynamically compile when the page is requested (during runtime).
<%@ Page Language="C#" Inherits="MyBlog.HelloWorld" src="HelloWorld.cs" mce_src="HelloWorld.cs" trace="true" %>
<html>
<body>
<asp:Label id="lblMessage" runat="server" />
</body>
</html>
Simply saying Codebehind is generated automatically by Visual Studio .Net whereas the Src is used to refer the code behind(Preferably in case of application development without VS .Net).
Comments
- Anonymous
July 15, 2008
PingBack from http://blog.a-foton.ru/2008/07/codebehind-vs-src/