i used this way.. bt its not working.. whats wrong in this ?
protected void btnDltMul_Click(object sender, EventArgs e)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("cbRows");
// System.Windows.Forms.MessageBox.Show(chk.ToString());
if (chk.Checked == true)
{
string sid = ((Label)GridView1.Rows[i].FindControl("lblsid")).Text;
objcon.Open();
// System.Windows.Forms.MessageBox.Show(sid.ToString());
SqlCommand comm = new SqlCommand("DELETE from scraps where toId=@toId AND sid=@sid", objcon);
comm.Parameters.AddWithValue("@toId", p.profile_Id);
comm.Parameters.AddWithValue("@sid", Convert.ToInt32(sid.ToString()));
comm.ExecuteNonQuery();
objcon.Close();
GridView1.DataBind();
}
}
GridView1.DataBind();
//upscrap.Update();
}