前台代码:
<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeFile="viewthread.aspx.cs" Inherits="Forum_viewthread" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>执行顺序测试</title>
</head>
<body>
<%Show();%>
</body>
</html>
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Print1");
}
protected void Show()
{
Response.Write("Print2");
}
输出结果:
先输出:Print1 后输出:Print2