Results 1 to 3 of 3

Thread: Data List repeating column background img

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    143

    Data List repeating column background img

    Hi,

    I have a datalist that has two repeating columns.

    I need to have both columns in just one table as I am using a background image for the table and need it to span across both columns.

    So I need something like this (psuedo ish code):

    Code:
    <asp:DataList id="DataList1" runat="server" RepeatDirection="Horizontal" RepeatColumns="1" RepeatLayout="Table"
    OnItemDataBound="DataList1_OnItemDataBound" Width="780px">
    
    <ItemTemplate>
    	<table border=1 height="192px" width="780px" class="galleryslash" cellpadding="5">
    		<tr>
    			<td><%# DataBinder.Eval(Container.DataItem, "title1") %><!--first record--></td>
    			<td><%# DataBinder.Eval(Container.DataItem, "title2") %><!--next record--></td>
    		</tr>
    	<table>
    </ItemTemplate>
    So the end result would look something like this:
    html example

    Any ideas how I can achieve this?

    Thanks
    F

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    143

    Re: Data List repeating column background img

    I think I've managed to hack it to get what I need. Basically by splitting the table between the item template and alternating item template:

    Code:
                  	<asp:DataList id="DataList1" runat="server" RepeatDirection="Horizontal" RepeatColumns="2" RepeatLayout="Table"
    		OnItemDataBound="DataList1_OnItemDataBound" Width="780px">
    			<ItemTemplate>
    				<table border=0 Width="780px" height="192px" class="gallery">
    					<tr>
    						<td>Row 1</td>
    			</ItemTemplate>
    			<AlternatingItemTemplate>
    						<td>Row 2</td>
    					</tr>
    				</table>
    			</AlternatingItemTemplate>
    		</asp:DataList>
    It's a bit dirty but it (so far) seems to do the trick...

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Data List repeating column background img

    That's pretty much how you would do it with tables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width