我想在网格中有 3 行,然后用粗线分隔第 3 行和第 4 行,然后再有 3 行,然后用粗线分隔第 6 行和第 7 行,等等。
执行此操作的最佳方法是什么?
即。
Row 1
Row 2
Row 3
-------------
Row 4
Row 5
Row 6
-------------
最佳答案
这样的事情应该可行。
代码隐藏:
private int RowCount { get; set; }
protected void myGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
switch(e.Row.RowType)
{
case DataControLRowType.Header:
{
RowCount = 0;
}
break;
case DataControlRowType.DataRow:
{
RowCount += 1;
if (RowCount == 3)
{
e.Row.CssClass = "BorderRow";
RowCount = 0;
}
}
break;
}
}
CSS:
tr.BorderRow td { border-bottom: 3px solid #000000; }
关于asp.net - ASP.NET GridView 控件中每 3 行的粗网格线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4683612/