views:

288

answers:

3

I'm using a datalist control. How I can add a row separator in the datalist? I have more than one item in a row and I'm using .Net 2.0.

Separator template work for each item not for each row.
I want to display it like this.

row1-> item1 item2 
---separator
row2-> item3 item4
---separator
row3-> item5 item6
+1  A: 

Here you go: http://www.asp.net/Learn/Data-Access/tutorial-30-cs.aspx

IrishChieftain
+2  A: 

Try this:

<asp:DataList>
    <SeparatorTemplate>
        <hr />
    </SeparatorTemplate>
</asp:DataList>

Update

If you want a simple border this way may help. the only problem is that latest row has a separator too.

<asp:DataList ID="DL1" runat="server" Width="200px" RepeatDirection="Horizontal" RepeatColumns="2" CssClass="DL1" CellPadding="0" CellSpacing="0">
    <ItemTemplate>
    .
    .
    .
    </ItemTemplate>
</asp:DataList>


.DL1 td
{
    border-bottom: solid 1px silver;
    border-collapse: collapse;
}
Mehdi Golchin
SeparatorTemplate is for each item not for rows (with multiple items).
Sharique
Updated, check it out.
Mehdi Golchin
+1  A: 

Use DataList.SeparatorTemplate Property

e.g.

<SeparatorTemplate>

        <asp:Image id="SeparatorImage"
             ImageUrl="SeparatorImage.jpg"
             runat="server"/>

     </SeparatorTemplate>

And look into this DataList.SeparatorTemplate Property

priyanka.sarkar