Row separator in datalist

﹥>﹥吖頭↗ 提交于 2019-12-08 07:37:43

问题


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:


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



回答2:


Use DataList.SeparatorTemplate Property

e.g.

<SeparatorTemplate>

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

     </SeparatorTemplate>

And look into this DataList.SeparatorTemplate Property




回答3:


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



来源:https://stackoverflow.com/questions/1774590/row-separator-in-datalist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!