datalist的实现 protected int i = 0; protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e) { i++; if (i / 10 == 1) { e.Item.Controls.Add(new System.Web.UI.LiteralControl("</td></tr><tr width='100%'><td colspan='10' style='background-image:url(images/ClassSeparator.gif); background-repeat:repeat-x; height:3px; width:100%'></td></tr><tr><td>")); } if (i == 10) { i = 0; } } 注意:RepeatDirection="Horizontal" repeater的实现 protected int i = 0; protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (i % 18 == 0) { e.Item.Controls.Add(new System.Web.UI.LiteralControl("</tr><tr>")); } i++; } 转载于:https://www.cnblogs.com/Fernando/archive/2007/12/06/985352.html