Actually what i want to do is, display a table content to the grid view and allow user to delete from the grid view.
For the delete function, i am thinking about having a checkbox and a button outside DataGridView. After the user check the data they want to delete(s), they will click the delete button. When the button click, it will check the checked checkbox and delete. That's why i assign the ID value to the checkbox, so it could know the id to delete.
now i able to display data grid with assign the value, but i dont know how to read the value of the checkbox...
here is the latest code
-
SqlConnection conn = new SqlConnection(map);
-
string sql = "Select * from Table_Name";
-
SqlDataAdapter adap = new SqlDataAdapter(sql, conn);
-
SqlCommandBuilder build = new SqlCommandBuilder(adap);
-
DataTable dt = new DataTable("Table_Name");
-
adap.Fill(dt);
-
chkDelete.DataPropertyName = "ID";
-
dataGridView1.DataSource = dt;
-
on event delete button fired, how to read the value of checkbox
Thank You