1
Answer

there is no error but cmd query take input as -1.

please check the error  
 
 
protected void dgrd_DeleteCommand(object source, DataGridCommandEventArgs e)
{
con = new SqlConnection(s);
// cmd = new SqlCommand("delete from section where sectionid='" + dgrd.DataKeys[e.Item.ItemIndex].ToString()+"'", con);
// cmd = new SqlCommand("delete from section where sectionid='" + dgrd.SelectedIndex.ToString()+"'", con);
cmd = new SqlCommand("delete from section where sectionid='" + dgrd.Items.ToString() + "'", con);
con.Open();
// int rows = cmd.ExecuteNonQuery();
//if (rows > 0)
//{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Deleted", "<script>alert('Deleted Successfully')</script>");
bid();
//}
}

Answers (1)