protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow gr in GridView1.Rows)
{
var chk = gr.FindControl("CheckBox1") as CheckBox;
if (chk.Checked == true)
{
var str12 = gr.FindControl("lblp") as Label;
SqlConnection con = new SqlConnection("s");
con.Open();
string str = "delete from [order] where order_id=@order_id";
SqlCommand cmd = new SqlCommand(str, con);
cmd.Parameters.AddWithValue("@order_id",str12.Text);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
con.Close();
GridView1.DataSource = dt;
GridView1.DataBind();
bind();
}
}
{
foreach (GridViewRow gr in GridView1.Rows)
{
var chk = gr.FindControl("CheckBox1") as CheckBox;
if (chk.Checked == true)
{
var str12 = gr.FindControl("lblp") as Label;
SqlConnection con = new SqlConnection("s");
con.Open();
string str = "delete from [order] where order_id=@order_id";
SqlCommand cmd = new SqlCommand(str, con);
cmd.Parameters.AddWithValue("@order_id",str12.Text);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
con.Close();
GridView1.DataSource = dt;
GridView1.DataBind();
bind();
}
}

