ASP.NET从1.1到2.0的变更要点(转)ASP.NET提供了两种组织代码的方式,不管是ASP.NET1.X还是ASP.NET2.0都是通用的
ASP.NET从1.1到2.0的变更要点(转)
1)内置代码分离
ASP.NET从1.1到2.0的变更要点(转)这是最基本的一种方式,感觉是为了和传统的ASP兼容才提出的。这种方式同样用于介绍ASP.NET知识点,例如建立一个WebCodeSeparated.aspx页面,可能的代码如下
ASP.NET从1.1到2.0的变更要点(转)WebCodeSeparated.aspx
ASP.NET从1.1到2.0的变更要点(转)
</html>
ASP.NET从1.1到2.0的变更要点(转)
<head>
ASP.NET从1.1到2.0的变更要点(转)
<script ruant="server">
ASP.NET从1.1到2.0的变更要点(转)
</script>
ASP.NET从1.1到2.0的变更要点(转)
</head>
ASP.NET从1.1到2.0的变更要点(转)
<body>
ASP.NET从1.1到2.0的变更要点(转)
</body>
ASP.NET从1.1到2.0的变更要点(转)
</html>
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转)(
2)页面布局和逻辑代码分离的文件,
ASP.NET从1.1到2.0的变更要点(转)   VS2003就采用的这种思想,例如上面的WebCodeSeparated.aspx可能为
ASP.NET从1.1到2.0的变更要点(转)WebCodeSeparated.aspx和
ASP.NET从1.1到2.0的变更要点(转)WebCodeSeparated.aspx.cs
ASP.NET从1.1到2.0的变更要点(转)为了关联两者关系,可以使用Codebehind和Inherits进行说明 
ASP.NET从1.1到2.0的变更要点(转)   在VS2005里,提供了parital关键字 
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转)现在把一个Label控件、一个TextBox控件和一个Button控件托放到WebCodeSeparated.aspx上,最后生成的Source类似如下:
ASP.NET从1.1到2.0的变更要点(转)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebCodeSeparated.aspx.cs" Inherits="WebCodeSeparated" %>
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转)WebCodeSeparated.aspx
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转)
<html xmlns="http://www.w3.org/1999/xhtml" >
ASP.NET从1.1到2.0的变更要点(转)
<head runat="server">
ASP.NET从1.1到2.0的变更要点(转)    
<title>Untitled Page</title>
ASP.NET从1.1到2.0的变更要点(转)
</head>
ASP.NET从1.1到2.0的变更要点(转)
<body>
ASP.NET从1.1到2.0的变更要点(转)    
<form id="form1" runat="server">
ASP.NET从1.1到2.0的变更要点(转)    
<div>
ASP.NET从1.1到2.0的变更要点(转)        
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
ASP.NET从1.1到2.0的变更要点(转)        
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
ASP.NET从1.1到2.0的变更要点(转)        
<br />
ASP.NET从1.1到2.0的变更要点(转)        
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></div>
ASP.NET从1.1到2.0的变更要点(转)    
</form>
ASP.NET从1.1到2.0的变更要点(转)
</body>
ASP.NET从1.1到2.0的变更要点(转)
</html>
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转) WebCodeSeparated.aspx.cs
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转)
ASP.NET从1.1到2.0的变更要点(转)
public partial class WebCodeSeparated : System.Web.UI.Page

相关文章: