计算DataGrid选中的记录数
2015-03-24 11:42:31 访问(2009) 赞(0) 踩(0)
/// <summary>
/// 计算DataGrid选中的记录数
/// </summary>
/// <param name="gv"></param>
/// <returns></returns>
protected int DataGridSelectedCount(DataGridView gv)
{
int theResult = 0;
int iCount = gv.Rows.Count;
string columnId = Column__CheckBox.Name;
string strTrue = "1";
object oValue = null;
for (int i = 0; i < iCount; ++i)
{
oValue = gv.Rows[i].Cells[columnId].Value;
if (oValue == null || oValue.ToString() != strTrue)
continue;
++theResult;
}
return theResult;
}
上一条:
下一条:
相关评论
发表评论