0
是否有任何其他方式刪除gridview列,除了使用索引.. 我正在使用gridview與多個複選框。 我想刪除其複選框被選中所有列.. 我retriving複選框作爲..gridview列刪除
protected void ButtonApprove_Click(object sender, EventArgs e)
{
StringCollection sc = new StringCollection();
string id = string.Empty;
for (int i = 0; i < GridView1.Rows.Count; i++)//loop the GridView Rows
{
//find the CheckBox
CheckBox cb =
(CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox1");
if (cb != null)
{
if (cb.Checked)
{
// get the id of the field to be deleted
id = GridView1.Rows[i].Cells[1].Text;
// add the id to be deleted in the StringCollection
sc.Add(id);
}
}
}
UpdateRecords(sc);
}
更多信息請你正在做什麼,你確切需要什麼 – Dotnet 2011-03-22 11:29:16
所以你想要刪除所有選定的記錄正確 – Dotnet 2011-03-22 11:32:13
確切..我想刪除所有選中的並將它們添加到另一個gridview – user123 2011-03-22 11:35:22