1.<%%> used to bind background code
Such as:
<%
for (int i=0;i<100;i++)
{
Reaponse.write (i.ToString ());
}
%>
2.<%#%> is executed when the bound control DataBind () method is executed for data binding
such as: <% # Container.DataItem ("title")%>, <%# Eval ("title")%>
3.<%=%> The variable or method used to bind the background with a return value, but at this time the variable name or method's access modifier is protected or public
such as:<%=name%> <%=getstr ()%>
4.<%@%> used to import a background namespace
such as: <%@ import namespace= "System.Data" >
5.<%$%> used to bind strings in Web. config (key-value pairs)
such as: <asp:textbox runat= "Server" id= "CC" text= "<%$ connectionstrings:pubs%>" ></asp:TextBox>
Web. config
<configuration>
<system.web>
<compilation debug= "True" targetframework= "4.0"/>
</system.web>
<connectionStrings>
<add name= "Pubs" connectionstring= "server=.; Database=pubs;uid=sa;pwd= "providername=" System.Data.SqlClient "/>
</connectionStrings>
</configuration>
ASP <%%>,<%#%>,<%=%>,<%@%>,<%$%> Usage Differences