任何人都知道如何用转发器显示4个水平项目?转发器默认显示下降的项目.到目前为止,这是我的测试转发器代码:
<table border=0 cellpadding=0 cellspacing=0 align="center" width="800px;> <tr> <asp:Repeater ID="rptTest" runat="server"> <ItemTemplate> <td> <h3><a href="<%#GetItemLink((Item)Container.DataItem) %>"><%#((WebMenuItem)Container.DataItem).Name %></a></h3> <div> <a href="<%#GetUrl((Item)Container.DataItem) %>"> <img src="<%#Getimage((Item)Container.DataItem) %>" alt="<%#GetAltText((Item)Container.DataItem) %>" /> </a> </div> </td> </ItemTemplate> </asp:Repeater> </tr> </table>
解决方法
<table> <asp:Repeater id="rptTest" runat="server"> <ItemTemplate> <%# (Container.ItemIndex + 4) % 4 == 0 ? "<tr>" : string.Empty %> <td> ... cell contents omitted ... </td> <%# (Container.ItemIndex + 4) % 4 == 3 ? "</tr>" : string.Empty %> </ItemTemplate> </asp:Repeater> </table>
简陋的转发器万岁!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。