<% $ %> 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.