开发者

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 dis开发者_JAVA百科play it like this.

row1-> item1 item2 
---separator
row2-> item3 item4
---separator
row3-> item5 item6


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


Use DataList.SeparatorTemplate Property

e.g.

<SeparatorTemplate>

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

     </SeparatorTemplate>

And look into this DataList.SeparatorTemplate Property


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜