开发者

Photo gallery in ListView

Is there any way creating a photo gallery using Listview control ?

Im playing with this templates aroud,but i cant get the difrent pictures in one line.

I d like to have 3 pictures in one line开发者_运维知识库. Somthing like

Pic 1 Pic 2 Pic 3

Pic 4 Pic 5 Pic 6

Now I have it like

Pic 1 Pic 1 Pic 1

Pic 2 Pic 2 Pic 2

My code

 <LayoutTemplate>
     <table>

        <asp:PlaceHolder ID="groupPlaceholder" runat="server"></asp:PlaceHolder>
     </table>
 </LayoutTemplate>
 <GroupTemplate>
    <tr>
        <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
    </tr>
 </GroupTemplate>

 <ItemTemplate>
    <tr>
        <td>
            <img alt="" src="<%# "http://" + Request.Url.Authority + "/" + Eval("thumbnailPath") %>" />
        </td>
        <td>
            <img alt="" src="<%# "http://" + Request.Url.Authority + "/" + Eval("thumbnailPath") %>" />
        </td>
        <td>
            <img alt="" src="<%# "http://" + Request.Url.Authority + "/" + Eval("thumbnailPath") %>" />
        </td>
    </tr>
 </ItemTemplate>  

Im getting the urls for the pictures in a collection,therefor ListView.


Forget the tables - clean markup is the main motive for using the ListView in the first place. Create a simple containing div for the entire set and set the width to the combined width of three images (plus any padding you have for borders and the like).

Then the natural flow of the page will put them in separate rows for you.

[Update] Here's some sample markup and CSS to help you get started :-) http://woorkup.com/2009/10/07/how-to-distribute-elements-horizontally-using-css/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜