1
我已經加入datagridview的一個複選框列和動態的DataGridView中添加的每一行的值問題與DataGridView的複選框列
現在,當我點擊的DataGridView排序的第一行復選框被自動取消選中
我已經在datagridview的 再次將數據綁定的DataGridView的排序事件編寫的代碼,但仍是第一行復選框列未被選中自動
這裏是我的代碼
if (attachedActiveStatus.ContainsKey(row.Cells["ServerId"].Value.ToString()))
{
DataGridViewCheckBoxCell cell1 = (DataGridViewCheckBoxCell)row.Cells[0];
cell1.Value = true;
row.Cells[0].Value = "true";
row.Cells[4].Value = attachedPriority[row.Cells["ServerId"].Value.ToString()];
switch (attachedActiveStatus[row.Cells["ServerId"].Value.ToString()])
{
case "0":
row.Cells["Status"].Value = "Offline";
break;
case "1":
row.Cells["Status"].Value = "Active";
break;
case "2":
row.Cells["Status"].Value = "Inactive";
break;
}
}
你能把你的代碼放在這裏嗎? – 2011-12-27 10:42:34
這是屬於winform還是asp.net,有更多的標籤可用? – V4Vendetta 2011-12-27 10:51:04
如果你像上面那樣添加,那麼你在排序的事件中綁定了什麼/如何綁定,這個複選框的值是否爲false? – V4Vendetta 2011-12-27 11:08:37