Sharique
Sharique

Reputation: 4219

Row separator in datalist

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

Upvotes: 2

Views: 6352

Answers (3)

IrishChieftain
IrishChieftain

Reputation: 15253

Formatting the DataList and Repeater Based Upon Data is explained with examples here,have a look.

Upvotes: 0

m3kh
m3kh

Reputation: 7941

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;
}

Upvotes: 5

priyanka.sarkar
priyanka.sarkar

Reputation: 26498

Use DataList.SeparatorTemplate Property

e.g.

<SeparatorTemplate>

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

     </SeparatorTemplate>

And look into this DataList.SeparatorTemplate Property

Upvotes: 0

Related Questions