السلام عليكم...
ياليت القى كود مشابه للكود المرفق بـــ vb
protected void Button1_Click(object sender, EventArgs e)
{
ArrayList list = new ArrayList();
foreach (GridViewRow row in GridView1.Rows)
{
int id = int.Parse(row.Cells[0].Text);
CheckBox cb = (CheckBox)row.Cells[2].Controls[1];
if (cb.Checked)
{
list.Add(id);
SqlConnection conn = new SqlConnection(@"Data Source=ksu-0c1adb2d5b8\A;Initial Catalog =employee;Persist Security Info=True;User ID=sa;Password=sara");
SqlCommand adapter = new SqlCommand("delete FROM Employee where id='" + id.ToString() + "'", conn);
conn.Open();
adapter.ExecuteNonQuery();
}
}
TextBox1.Text = "";
foreach (int x in list)
{
TextBox1.Text += x + "; ";
}
}
}