Multiple row deletion in GridView in Asp.net on Button Click

Thank you for reading this post, don't forget to subscribe!

CheckBox chk = new CheckBox();
foreach (GridViewRow dg1 in GridView1.Rows)
{
chk = (CheckBox)dg1.FindControl(“CheckBox1”);
Label lbldel = (Label)dg1.FindControl(“Label2”);

if (chk.Checked == true)
{
int ID = Convert.ToInt32(lbldel.Text);

// Pass this ID to Delete Command

Label1.Text = “data deleted”;

}
}