Asp.net 2.0 Application Development Technology Note 01

Source: Internet
Author: User
Tags xpath functions
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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.