title: All Row has a Delete Button in Gridview
body: <p>I have a simple page like this. (<code>EKLE = ADD</code>, <code>SİL = DELETE</code>)</p>
  
  <p><img src="https://i.stack.imgur.com/NU6Fb.jpg" alt="enter image description here"></p>
  
  <p>And my AVUKAT Table like this.</p>
  
  <p><img src="https://i.stack.imgur.com/8DbvB.jpg" alt="enter image description here"></p>
  
  <p>Simplify, When i choose first dropdown MUSTERI and second dropdown AVUKAT , add the database (getting HESAP (number) automaticly) or delete the database and gridview.</p>
  
  <p>This is my code.</p>
  
  <blockquote>
    <p>ADD Click</p>
  </blockquote>
  
  <pre><code>protected void Add_Click(object sender, EventArgs e)
      {
          string strConnectionString = ConfigurationManager.ConnectionStrings["SqlServerCstr"].ConnectionString;
  
          SqlConnection myConnection = new SqlConnection(strConnectionString);
          myConnection.Open();
  
  
          string hesap = Label1.Text;
          string musteriadi = DropDownList1.SelectedItem.Value;
          string avukat = DropDownList2.SelectedItem.Value;
  
          SqlCommand cmd = new SqlCommand("INSERT INTO AVUKAT VALUES (@MUSTERI, @AVUKAT, @HESAP)", myConnection);
  
          cmd.Parameters.AddWithValue("@HESAP", hesap);
          cmd.Parameters.AddWithValue("@MUSTERI", musteriadi);
          cmd.Parameters.AddWithValue("@AVUKAT", avukat);
          cmd.Connection = myConnection;
  
  
  
          SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
  
          /*GridView1.DataSource = dr;
          GridView1.Visible = true;*/
          Response.Redirect(Request.Url.ToString());
          myConnection.Close();
      }
  </code></pre>
  
  <blockquote>
    <p>DELETE Click</p>
  </blockquote>
  
  <pre><code>protected void Delete_Click(object sender, EventArgs e)
      {
          string strConnectionString = ConfigurationManager.ConnectionStrings["SqlServerCstr"].ConnectionString;
  
          SqlConnection myConnection = new SqlConnection(strConnectionString);
          myConnection.Open();
  
  
          string hesap = Label1.Text;
          string musteriadi = DropDownList1.SelectedItem.Value;
          string avukat = DropDownList2.SelectedItem.Value;
  
          SqlCommand cmd = new SqlCommand("DELETE FROM AVUKAT WHERE  MUSTERI = @MUSTERI AND AVUKAT = @AVUKAT AND HESAP = @HESAP", myConnection);
  
          cmd.Parameters.AddWithValue("@HESAP", hesap);
          cmd.Parameters.AddWithValue("@MUSTERI", musteriadi);
          cmd.Parameters.AddWithValue("@AVUKAT", avukat);
          cmd.Connection = myConnection;
  
          SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
  
          /* GridView1.DataSource = dr;
           GridView1.Visible = true;*/
          Response.Redirect(Request.Url.ToString());
          myConnection.Close();
      }
  </code></pre>
  
  <p>My manager wants, delete process is so hard. Let's make easy. Because when i want to delete some data, i must choose two dropdownlist and then delete(Sil) button.</p>
  
  <p>We should prefer that every row has a delete button. Then when we click the button. Then must be deleted gridview <code>AND</code> databse.</p>
  
  <p>I found perfect example on the internet abuot what i want.</p>
  
  <p><img src="https://i.stack.imgur.com/YNBHP.jpg" alt="enter image description here"></p>
  
  <p>I think if we can do that, Sil(Delete) Button should be deleted.</p>
  
  <p>How can we do that?</p>
  
  <p>I think <code>AutoDeleteButton</code> don't work like this. Right? It just deleted from Gridview. Not Database. But i want deleting both (Gridview <code>AND</code> Database)</p>