类似
*******
*******
*******
*******
----------
*******
*******
*******
*******
----------
*******
*******
*******
*******
----------
方法一:
在后台定义一个公共计数变量
public int i = 0;
<asp:dataList id="">
<asp:itemteplate>
<%
if(i++%4==0 && i>0)
{
%>
<hr>
<%
}
%>
</asp:itemtemplate>
</asp:dataList>
方法二:
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if ((e.Item.ItemIndex + 1) % 4 == 0)
{
Literal lit = new Literal();
lit.Text = "<hr />";
e.Item.Controls.Add(lit);
}
}