I am adding checkbox to datagridview.
how can I add a checkbox to the header so that when I click that all the checkboxes should be checked and corresponding rows should be deleted.. I am able to delete one row at a time. How to delete multiple rows..
DataGridViewCheckBoxColumn chkBoxColumn = new DataGridViewCheckBoxColumn();
chkBoxColumn.Name = "CheckBoxes";
dataGridView1.Columns.Add(chkBoxColumn);
Deleting one row...
private void btnDelete_Click(object sender, EventArgs e)
{
if (GlobalDataStore.GetInstance().CheckedStatus == true)
{
string fName = GlobalDataStore.GetInstance().FirstName;
string relation = GlobalDataStore.GetInstance().Relation;
string idcardno = GlobalDataStore.GetInstance().Idcardno;
string query = "DELETE FROM DETAIL WHERE idcard_no = '" + idcardno.Trim() + "'" + " AND FM_NAME = '" + fName.Trim() + "'" + " AND rln_fm_nm = '" + relation.Trim() + "'";
DataSet ds = new DataSet();
OracleDataAdapter da = new OracleDataAdapter(query, this.connection);
da.Fill(ds);
DataTable dt = ds.Tables[0];
dt.Columns.Add("View");
DataRow dr = dt.NewRow();
dr["View"] = "View";
dt.Rows.Add(dr);
dt.AcceptChanges();
DataView my_DataView = dt.DefaultView;
dataGridView1.DataSource = my_DataView;
connection.Close();
}
}
Can anyone help me with the logic...
regards
venkat