Here is my code for listView
and Data 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>
By this code , listView
show images vertically , I want to show my images horizontally.
How can I change the orientation of listView
?
If you just want to show the images in a single row, you can just put them in the columns of a single row. Try rewriting the listview markup as follows (move table
,tr
markups into 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>