title: Delete data row from sql in a gridview
body: <p>I am trying to delete data from a gridview using a a link button. I need help with the logic and making the link button remove the row data from the database on click.</p>
  
  <p><strong>GridView</strong></p>
  
  <pre><code>        &lt;asp:GridView Style="width: 100%" ID="GvReportResults" runat="server"                       AutoGenerateColumns="False" EmptyDataText="No data" ShowHeaderWhenEmpty="True"&gt;
              &lt;Columns&gt;
                  &lt;asp:TemplateField&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:LinkButton ID="lnkBtnEdit" runat="server" CausesValidation="false" &gt;Edit&lt;/asp:LinkButton&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:LinkButton ID="LnkBtnRemove" runat="server" CausesValidation="false" CommandName="DeleteItem" CommandArgument='&lt;%# Eval("OtherDataID") %&gt;'&gt;Delete&lt;/asp:LinkButton&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:BoundField DataField="SourceID" HeaderText="ID" /&gt;
                  &lt;asp:BoundField DataField="LastName" HeaderText="Last Name" /&gt;
                  &lt;asp:BoundField DataField="FirstName" HeaderText="First Name" /&gt;
                  &lt;asp:BoundField DataField="MiddleName" HeaderText="Middle Name" /&gt;
                  &lt;asp:BoundField DataField="Title" HeaderText="Title" /&gt;
                  &lt;asp:BoundField DataField="NationalID" HeaderText="SSN" /&gt;
                  &lt;asp:BoundField DataField="DOB" HeaderText="DOB" /&gt;
                  &lt;asp:BoundField DataField="HireDate" HeaderText="Hire Date" /&gt;
                  &lt;asp:BoundField DataField="Address1" HeaderText="Address" /&gt;
                  &lt;asp:BoundField DataField="City" HeaderText="City" /&gt;
                  &lt;asp:BoundField DataField="State" HeaderText="State" /&gt;
                  &lt;asp:BoundField DataField="PostalCode" HeaderText="Zip Code" /&gt;
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p><strong>Store precedure thats importing data to gridview</strong></p>
  
  <pre><code>    private void BindGrid()
  {
      //set up arguments for the stored proc
      int? FacilityID = (ddlFacility2.SelectedValue.Equals("-1")) ? (int?)null : int.Parse(ddlFacility2.SelectedValue);
      int? OtherDataID = null;
  
      //bind
      GvReportResults.DataSource = this.DataLayer.model.MS_spGetOtherData(FacilityID, OtherDataID);
      GvReportResults.DataBind();
  }
  </code></pre>