我正在检查 GridView1_RowDataBound 事件中的复选框值,但出现错误“运算符不能应用于字符串或布尔类型的操作数”..
这是我的相同代码...
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
for (int i = 1; i < e.Row.Cells.Count - 2; i++)
{
CheckBox cb = new CheckBox();
if (e.Row.Cells[i].ToString() == true)
{
cb.Checked = true;
}
else
{
cb.Checked = false;
}
e.Row.Cells[i].Controls.Add(cb);
}
}
}
请帮助我..提前谢谢..