{
foreach (GridViewRow grow in GridView1.Rows)
{
CheckBox chk = (CheckBox)grow.FindControl("chk1");
if (chk.Checked)
{
int empid =Convert.ToInt32(grow.Cells[1].Text);
deleterecord(empid);
}
}
Bind();
}
protected static void deleterecord(int empid)
{
SqlConnection con = new SqlConnection("Data Source=desktop-tvrrh2v;Initial Catalog=FROMSQL;Integrated Security=True");
SqlCommand cmd = new SqlCommand("delete from grrid where id=@id", con);
cmd.Parameters.AddWithValue("@id",empid);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
Vincent Maverick DuranoPosted May 17, 2016, 11:18 AM
Pradeep SahooPosted May 14, 2016, 11:47 PM