title: Deleting is not supported by data source 'SqlDataSource1' unless DeleteCommand is specified
body: <p>I have an ASP button link in <code>GridView1</code> that should delete an item from a db table on click, and I am getting this error message:</p>
  
  <pre><code>Deleting is not supported by data source 'SqlDataSource1' unless DeleteCommand is specified. 
  </code></pre>
  
  <p>This is the code:</p>
  
  <p><strong>VB.NET</strong></p>
  
  <pre><code>Protected Sub GridView1_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GridView1.RowCommand
  
  
      If e.CommandName.Equals("Delete") Then
  
  
          Dim rowIndex As Integer = Convert.ToInt32(e.CommandArgument)
          Dim rowID As String = e.CommandArgument.ToString()
          Dim conn As New SqlConnection("Data Source=BRIAN-PC\SQLEXPRESS;Initial Catalog=master_db;Integrated Security=True;")
          Dim cmd As New SqlCommand("DELETE content WHERE content_id=@rowID", conn)
  
          cmd.Parameters.AddWithValue("@rowID", rowID)
  
          conn.Open()
          cmd.ExecuteNonQuery()
          conn.Close()
  
  
      End If
  
  End Sub
  </code></pre>
  
  <p><strong>ASP</strong></p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" ViewStateMode="Enabled"&gt;
          &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="content_name" HeaderText="Content Name" SortExpression="content_name"&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:BoundField DataField="content_type" HeaderText="Content Type" SortExpression="content_type"&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:buttonfield buttontype="Link" commandname="Delete" text="Delete"&gt; 
               &lt;ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /&gt;
              &lt;/asp:buttonfield&gt;
               &lt;asp:TemplateField HeaderText=" "&gt;
              &lt;ItemTemplate&gt;
              &lt;asp:LinkButton ID="lnkDownload" runat="server" Text="Download" OnClick="lnkDownload_Click" &gt;&lt;/asp:LinkButton&gt;
              &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
          &lt;/Columns&gt;
          &lt;EditRowStyle BackColor="#999999" /&gt;
          &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
          &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
          &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
          &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
          &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
          &lt;SortedAscendingCellStyle BackColor="#E9E7E2" /&gt;
          &lt;SortedAscendingHeaderStyle BackColor="#506C8C" /&gt;
          &lt;SortedDescendingCellStyle BackColor="#FFFDF8" /&gt;
          &lt;SortedDescendingHeaderStyle BackColor="#6F8DAE" /&gt;
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>From what I read you need to specify a DELETE command for <code>SQLDataSource1</code>.</p>
  
  <p>How do I do that in my case?</p>