标签:variable upload 注释 pat a10 href tail public close
//相当于<!---->
//相当于写在后台的可执行代码
<form id="form1" runat="server"> <%--绑定后台代码块--%> <% for (int i = 1; i <= 10; i++) { %> <%=i %> <%} %> </form>
//还可以绑定后台方法<%=NewMethod()%> 也可以写作<%:variable %>
namespace WebApplication { public partial class Index : System.Web.UI.Page { public string _title = ""; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { _title = "标题"; } } } }
<form id="form1" runat="server"> <asp:Repeater ID="Repeater" runat="server"> <ItemTemplate> <span><%# Eval("name") %></span> </ItemTemplate> </asp:Repeater> </form>
<form id="form1" runat="server"> <asp:Literal ID="Literal1" runat="server" Text="<%$appSettings:upload_image_path%>" /> </form>
web.config<configuration> <appSettings> <add key="upload_image_path" value="/upload/images/"/> </appSettings> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> </configuration>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="benben.Index" %>
asp.net 中<% %>、<%@ %>、<%# %>、<%= %>、<%$ %>的用法
标签:variable upload 注释 pat a10 href tail public close
原文地址:http://www.cnblogs.com/flycloudliestar/p/6512345.html