DataGridViewCheckBoxColumn chbIsTrue = new DataGridViewCheckBoxColumn();
dataGridView1.DataSource = Human.GetReserve(shopno, state).Tables[0].Copy();
dataGridView1.Columns.Add(chbIsTrue);
chbIsTrue.HeaderText = "通过";
以上的代码让datagridview除了数据之外又多显示了一列DataGridViewCheckBoxColumn
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
if (dataGridView1.Rows[i].Cells["状态"].Value.ToString() == "新申请")
{
chbIsTrue.checked=true;//没有这个属性
}
else
{
}
}
请高手指点一下 我如何把它设置为选中啊
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HiddenField hfView = (HiddenField)e.Row.FindControl("dataView");
HtmlInputCheckBox cbView = (HtmlInputCheckBox)e.Row.FindControl("cbView");
if (hfView.Value == "1")
{
cbView.Checked = true;
hfViewUsers.Value = string.IsNullOrEmpty(hfViewUsers.Value)? cbView.Value: hfViewUsers.Value + "," + cbView.Value;
}
}
chbIsTrue。name=“123”;
dataGridView1.DataSource = Human.GetReserve(shopno, state).Tables[0].Copy();
dataGridView1.Columns.Add(chbIsTrue);
chbIsTrue.HeaderText = "通过";
以上的代码让datagridview除了数据之外又多显示了一列DataGridViewCheckBoxColumn
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
if (dataGridView1.Rows[i].Cells["状态"].Value.ToString() == "新申请")
{
//chbIsTrue.checked=true;//没有这个属性
dataGridView1.Rows[i].Cells["123"].Value=true;
}
else
{
}
}