为了账号安全,请及时绑定邮箱和手机立即绑定

asp.net web网页问题

asp.net web网页问题

30秒到达战场 2019-05-14 09:08:22
<%@ 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") %> <%= %> <%# %>各代表什么意思呀?能否提供一些关于这方面的资料,谢谢了~~~~
查看完整描述

2 回答

?
隔江千里

TA贡献1906条经验 获得超10个赞

<%= %>是内联表达式,用作调用Write方法的快捷方式.
所以:"<%= ControlStyle %>"就表示,是Response.Write(ControlStyle)的快捷方式.

<%# %>表示数据绑定.
所以:<asp:HiddenField runat="server" ID="hidCategoryId" Value='<%# Eval("Id") %>' />就表示,HiddenField的值绑定到查询出的数据表列名为"ID"的数据列上.就你这个实例来看.这个数据表应该是对应到实例中"repCategories"这个Reaper的DataSource的DataTable或者DataSet.



查看完整回答
反对 回复 2019-05-15
  • 2 回答
  • 0 关注
  • 359 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信