一个网格表有 5 行,由数据库填充。
如果我们想删除 somerow 就可以了。
解决方案:
创建一个datatableTemp,在gridView上删除后,它也会删除一个表Temp。
之后,它将由 tableTemp 填充 GridView。
//========Get datatable from database.
dtTempGrdBlockForDeviceByRole = Cls_BLOCKS.getDataTable_WriteField();
grdBlockForDeviceByRole = Cls_BLOCKS.getDataTable_WriteField();
for (int x = 0; x < grdBlockForDeviceByRole.Rows.Count; x++)
{
CheckBox chk = grdBlockForDeviceByRole.Rows[x].FindControl("ckDelete") as CheckBox;
string txtD = grdBlockForDeviceByRole.Rows[x].Cells[0].Text;
if (chk.Checked)
{
//If choice
//What should we do in here?
}
}
grdBlockForDeviceByRole.DataSource = dtTempGrdBlockForDeviceByRole;
grdBlockForDeviceByRole.DataBind();
你能帮帮我吗?