1.
Aspx file content comment:
A. HTML <! -- Comment -->
B. Server Control <% -- Comment -- %>
Note: If you place the server controls in <% -- Comment content -- %>, these server controls will still run, but will not be displayed during display.
2. Server File Inclusion
A. ASP. NET 2.0 can contain server files as before, and can be anywhere
B. Syntax: <! -- # Include File = "IncludeFile. aspx" -->
3. Data Binding syntax
A. In the. aspx file, you can directly bind data in the middle of <% # And %>.
B. The Eval, Bind, and XPath functions can be used together to define one-way [Read-Only] binding. The Bind function is used to Bind two-way [updatable] binding. The XPath function is used to Bind data in XML format.
C. For example, the XPath function is used to bind data in XML format.
The code in codepage is as follows:
String xmlData = "";
XmlData = "<root>" +
"<Item> <name> aaa </name> <url> http://donet.aspx.cc/<url> </item>" +
"</Root> ";
System. Xml. XmlDocument doc = new System. Xml. XmlDocument ();
Doc. Lo9adXml (xmlData );
Rp. DataSource = doc. SelectNodes ("/root/item ");
This. DataBind ();
The code in aspx is as follows: <asp: Repeater id = "rp" runat = "server">
<ItemTemplate>
<Div>
<A href = '<% # XPath ("url") %>'>
<% # XPath ("name") %>
</A>
</Div>
</ItemTemplate>
</Asp: Repeater>