常見的有10種元素構成:
1、指令(directives)
指令部分放在標記中,將會被編譯。格式爲:
支持的頁面指令如下:
(1)@Page 指令:定義該頁面被解析器和編譯器處理的方式。詳細見MSDN.
(2)@Control指令:
(3)@Import指令:
(4)@Register指令:
(5)@Assembly指令:
(6)@OutputCache指令:
2、代碼聲明塊(code declaration blocks)
定義了成員變量和方法,格式如:
3、內聯代碼塊(code render blocks)
定義了內聯代碼或內聯表達式。當頁面在生成html代碼時,這些代碼和表達式被執行。
內聯代碼格式:<% inline code %>
內聯表達式格式:<% =inline code %>
<%
String s=”%" + “>”;
Response.Write(s);
%>
4、服務器端包含指令(server-side include directive syntax)
用來將指定文件的內容插入到asp.net頁面中。語法爲:
<!—#include file | virtual=filename --%>
5、服務器端註釋(server-side comments)
<%-- comments --%>
6、自定義服務器控件(user server control)
7、html控件(html control)
8、服務器控件的事件綁定
9、數據綁定表達式
10、服務器端對象標記