gridview列删除
问题描述:
是否有任何其他方式删除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