Angle brackets in Asp.net

Source: Internet
Author: User

<% $ %> This can only be used to retrieve the Web. config connection string.
Note: 1. Only server controls can be bound.
2. It can only be bound to a property of the server control.

<Asp: textbox runat = "server" id = "cc" text = "<% $ connectionstrings: pubs %>"> </ASP: textbox>

The Web. config file is as follows:

<Connectionstrings>
<Add name = "pubs" connectionstring = "Server =.; database = pubs; uid = sa; Pwd =" providername = "system. Data. sqlclient"/>
</Connectionstrings>

Both <% = %> and <% # %> are used for values,
<% = %> Cannot be used in the runat = "server" tag, and <% # %> is used in the runat = "server" tag.

<% @ Indicates: Reference
<% # Indicates binding
<% = Indicates: Value
<% = Variable name %>
<% # Field name to be bound %> or <% # Call the background method %>
<%> You can add judgment statements or code.

<% Inline code %> is called Inline code...
<% = Inline expression %> is called an inline expression...
<% # Data-binding expression %> is called a data binding expression...

The eval method is a static one-way (read-only) method. Therefore, the eval function is used for one-way (read-only) binding. This method uses the value of a data field as a parameter and returns it as a string.
The bind method supports the read/write function, so the BIND function is used for Bidirectional (updatable) binding. This method retrieves the value of the data-bound control and submits any changes to the database.
The XPath method supports XML data sources.
When the eval method is executed, the databinder. Eval method is called. When the databinder. Eval method is run, reflection is used to execute later binding calculations, which causes a significant reduction in performance.
Among the three, <% # (datarowview) container. dataitem) ["field name"] %> has the best performance.

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.