hi..
this is my code..but it only deletes the row on datagridview and the data "View" in Revit, it deletes all. Can I delete data in revit based on datagridview's checkbox table? Can you help me?
private void btnPurge_Click(object sender, EventArgs e)
{
int num = 0;
#region(test 2)
List<DataGridViewRow> selectedRows = (from row in datagridView1.Rows.Cast<DataGridViewRow>()
where Convert.ToBoolean(row.Cells["chk"].Value) == true
select row).ToList();
if (MessageBox.Show(string.Format("Do you want to delete {0} rows?", selectedRows.Count),
"Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
foreach (DataGridViewRow row in selectedRows)
{
datagridView1.Rows.Remove(row);
foreach (View view in allView)
{
Transaction tx2 = new Transaction(doc);
tx2.Start("Delete View");
doc.Delete(view.Id);
num += 1;
tx2.Commit();
}
}
}