如何得到datagridview中某列="某值"的数量?<br>
2 回答
GCT1015
TA贡献1827条经验 获得超4个赞
public int GetRowsCountByTargetColumn(GridView gv, int targetColumnIndex, string targetColumnValue) { bool ap = gv.AllowPaging; if(ap) gv.AllowPaging = false; int count = 0; foreach(GridViewRow row in gv.Rows) { if(row.Cells[targetColumnIndex].Text.Equals(targetColumnValue)) count++; } if(ap) gv.AllowPaging = true; return count; }
- 2 回答
- 0 关注
- 463 浏览
添加回答
举报
0/150
提交
取消