给DataList每五条数据加一个样式

protected void dtSituation_ItemDataBound(object sender, DataListItemEventArgs e)
{
if ((e.Item.ItemIndex + 1) % 5 == 0)
{
Literal lit = new Literal();
lit.Text = "<hr style='border:2px dotted gray;'>";
e.Item.Controls.Add(lit);
}


}

你可能感兴趣的:(datalist)