ASP. Net connects server code and special symbols on the front-end interface, and asp.net special symbols
1. <%> used to bind background code
For example:
< % for(int i=0;i<100;i++) { Reaponse.Write(i.ToString()); }%>
2. <% # %> is executed when the DataBind () method of the bound control is executed and used for data binding.
For example:
< %# Container.DataItem("title") %>
3. <% = %> is used to bind the variables or methods in the background and return values. However, the variable name or method access modifier is protected or public.
For example:
<%=name%> <%=getstr()%>
4. <% @ %> is used to import the background namespace
For example, <% @ import namespace = "system. data">
5. <% $ %> is used to bind a string (key-Value Pair) in web. config)
For example:
<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>
6. The data obtained by DataBind will be converted to another type by default as String?
DataBinder. eval_r (Container. DataItem, "Conversion Type", "format") Note: The format can not be this method = eval_r ("Conversion Type ")