Meanings of angle brackets and percent signs in Asp.net code

Source: Internet
Author: User
ArticleDirectory
    • Hello World

In the. aspx file, we often encounter the followingCodeSuch:

1. The variable name in <% = %>, such:

<Div>
<H1> Hello World <P> welcome to beginning ASP. NET 3.5 on<% =
Datetime. Now. tostring () %>
</P>
</Div>
Output result:

Hello World

Welcome to beginning ASP. NET 3.5 on 15:53:08

2. <% # %> Data Binding

For example: <% # Databinder. (container. dataitem, "classname") %>

Complete code: <asp: datalist id = "classlist" runat = "server">
<Itemtemplate> <% # databinder. (container. dataitem, "classname") %>
</Itemtemplate>
</ASP: datalist> </TD>

3. <% @ %> indicates reference.

For example, you can see the following code on many. aspx pages:

<% @ Page Language = "C #" codefile = "default. aspx. cs" inherits = "_ default" %>

4. <%> A typical ASPProgramStatement.

Example: <tr bgcolor = "# ffffff">
<TD Height = "20">
<Div align = "center"> category: </div>
</TD>
<TD Height = "9"> & nbsp;
<% St_getlist (); %>
</TD>
</Tr>

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.