gpt4 book ai didi

c# - asp.net 中的水平 ListView

转载 作者:太空宇宙 更新时间:2023-11-03 21:47:04 25 4
gpt4 key购买 nike

这是我的 listViewData Pager 代码,

 <asp:ListView runat="server" ID="PageHorizon">
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server">
</asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<table width="100%">
<tr>
<td width="25%">
<img src='<%#Eval("ImagePath")%>' alt="Single Image"
width="64px" height="64px" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:ListView>
<br />
<hr />
<asp:DataPager ID="DataPager1" runat="server" PagedControlID="PageHorizon"
PageSize="3">
<Fields>
<asp:NextPreviousPagerField ShowFirstPageButton="True"
ShowNextPageButton="True" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ShowLastPageButton="True"
ShowPreviousPageButton="True" />
</Fields>
</asp:DataPager>

通过这段代码,listView 垂直显示图像,我想水平显示我的图像。
如何更改 listView 的方向?

最佳答案

如果您只想在一行中显示图像,您可以将它们放在一行的列中。尝试按如下方式重写 ListView 标记(将 tabletr 标记移动到 LayoutTemplate 中):

<asp:ListView runat="server" ID="PageHorizon">
<LayoutTemplate>
<table>
<tr>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<td>
<img src='<%#Eval("ImagePath")%>' alt="Single Image"
width="64px" height="64px" />
</td>
</ItemTemplate>
</asp:ListView>

关于c# - asp.net 中的水平 ListView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16433063/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com