【发布时间】:2023-03-09 12:05:01
【问题描述】:
我读到here 说 td 标记必须嵌套,所以当我看到 ListView 的 ItemTemplate 属性标记看起来像这样时,我感到很困惑:
<ItemTemplate>
<td id="Td2" runat="server">
<table>
<tr>
<td> </td>
<td>
<a href="ProductDetails.aspx?productID=<%#:Item.ProductID%>">
<img src="/Catalog/Images/Thumbs/<%#:Item.ImagePath%>"
width="100" height="75" /></a>
</td>
<td>
<a href="ProductDetails.aspx?productID=<%#:Item.ProductID%>">
<span class="ProductName">
<%#:Item.ProductName%>
</span>
</a>
<br />
<span class="ProductPrice">
<b>Price: </b><%#:String.Format("{0:c}", Item.UnitPrice)%>
</span>
<br />
</td>
</tr>
</table>
</td>
</ItemTemplate>
这是否与 ListView 从某个类继承并实现大量接口这一事实有关?还是与我不熟悉的 ItemTemplate 的某些方面有关?我的来源是错误的还是“只是一个 ASP 的东西”?
【问题讨论】:
标签: html asp.net html-table