<%@ Control Language="C#" AutoEventWireup="true" CodeFile="NavigationControl.ascx.cs" Inherits="AspTest.Web.NavigationControl" %><%@ OutputCache Duration="100000" VaryByParam="*" %><asp:Repeater ID="repCategories" runat="server"><HeaderTemplate><table cellspacing="0" border="0" style="border-collapse: collapse;"></HeaderTemplate><ItemTemplate><tr><td class="<%= ControlStyle %>"><asp:HyperLink runat="server" ID="lnkCategory" NavigateUrl='<%# string.Format("~/Products.aspx?page=0&categoryId={0}", Eval("Id")) %>' Text='<%# Eval("Name") %>' /><asp:HiddenField runat="server" ID="hidCategoryId" Value='<%# Eval("Id") %>' /></td></tr></ItemTemplate><FooterTemplate></table></FooterTemplate></asp:Repeater>請教各位大蝦:上面的代碼中,<%= ControlStyle %> 及 <%# string.Format("~/Products.aspx?page=0&categoryId={0}", Eval("Id")) %>' Text='<%# Eval("Name") %> <%= %> <%# %>各代表什么意思呀?能否提供一些關(guān)于這方面的資料,謝謝了~~~~
2 回答

楊魅力
TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超6個贊
<%= %>是內(nèi)聯(lián)表達(dá)式,用作調(diào)用Write方法的快捷方式.
所以:"<%= ControlStyle %>"就表示,是Response.Write(ControlStyle)的快捷方式.
<%# %>表示數(shù)據(jù)綁定.
所以:<asp:HiddenField runat="server" ID="hidCategoryId" Value='<%# Eval("Id") %>' />就表示,HiddenField的值綁定到查詢出的數(shù)據(jù)表列名為"ID"的數(shù)據(jù)列上.就你這個實(shí)例來看.這個數(shù)據(jù)表應(yīng)該是對應(yīng)到實(shí)例中"repCategories"這個Reaper的DataSource的DataTable或者DataSet.
- 2 回答
- 0 關(guān)注
- 517 瀏覽
添加回答
舉報
0/150
提交
取消