Definitions of angle brackets and percent signs in ASP. NET

Source: Internet
Author: User
ArticleDirectory
    • Hello World

In the past, when page data was bound, we often encountered the usage of <% # %>, which was not checked at the time. Today we encountered a problem in JS, how to get the ID of the server control, so I think of this, first talk about the meaning of this symbol, this is also the information I checked online:

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") %>

CompleteCode: <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>

The above is a download from http://www.cnblogs.com/gnagwang/archive/2010/07/14/1777130.html.

Hope you can help new friends

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.