ASP.NET StartKit Commerce 結構簡單,適合初學者研讀。作者完整閱讀三次,總結關鍵學習點:
Container.ItemIndex 自動產生索引 (從 0 起),避免資料庫建立暫存表產生行號<asp:HyperLink cssclass="MenuSelected" id="HyperLink2"
Text='<%# DataBinder.Eval(Container.DataItem, "CategoryName") %>'
NavigateUrl='<%# "productslist.aspx?CategoryID=" + DataBinder.Eval(Container.DataItem, "CategoryID") + "&selection=" + Container.ItemIndex %>'
runat="server" />
注意:繫結運算式用單引號,內部字串用雙引號。
<authentication mode="Forms">
<forms name="CommerceAuth" loginUrl="login.aspx" protection="All" path="/" />
</authentication>
<location path="OrderDetails.aspx">
<system.web>
<authorization><deny users="?" /></authorization>
</system.web>
</location>
未登入使用者存取受保護頁面自動導向登入頁。