title: updating data into gridview in asp.net
body: <p>I am relatively new to asp.net.So please bear with me if my query is childish
  my grid design:</p>
  
  <pre><code>&lt;asp:GridView runat ="server"  GridLines = "Both" DataKeyNames="book_id"AutoGenerateColumns ="false" CellPadding ="5" CellSpacing ="5" allowpaging="True" allowsorting="True"
   ID="gv_table1" EmptyDataText ="No data exists"       OnRowEditing="gv_RowEditing"
  OnRowCancelingEdit="gv_RowCancelingEdit" OnRowUpdating="gv_RowUpdating" OnRowDeleting="gv_RowDeleting"&gt;
      &lt;Columns&gt;
  
  &lt;asp:BoundField HeaderText="Book ID"  DataField="book_id"&gt;
  
  &lt;/asp:BoundField&gt;
  
  
  
  &lt;asp:BoundField DataField="book_name"   HeaderText="Book Name"&gt;
  
  &lt;/asp:BoundField&gt;
  &lt;asp:BoundField DataField="author_name" HeaderText="Author Name"&gt;
  
  &lt;/asp:BoundField&gt;
  &lt;asp:BoundField DataField="publisher" HeaderText="Publisher"&gt;
  
  &lt;/asp:BoundField&gt;
  &lt;asp:BoundField DataField="year_edition" HeaderText="Year/Edition"&gt;
  
  &lt;/asp:BoundField&gt;
  &lt;asp:BoundField DataField="total_no" HeaderText="Total No"&gt;
  
  &lt;/asp:BoundField&gt;
  &lt;asp:BoundField DataField="available" HeaderText="Available"&gt;
  
  &lt;/asp:BoundField&gt;
  &lt;asp:BoundField DataField="tags" HeaderText="Tags"&gt;
  
  &lt;/asp:BoundField&gt;
  &lt;asp:BoundField DataField="fare" HeaderText="Fare"&gt;
  
  &lt;/asp:BoundField&gt;
  &lt;asp:BoundField DataField="state" HeaderText="State"&gt;
  
  &lt;/asp:BoundField&gt;
   &lt;asp:templatefield HeaderText ="Options"&gt;
                                  &lt;itemtemplate &gt;
  
                                          &lt;asp:linkbutton id="btnEdit" runat="server" commandname="Edit" text="Edit" /&gt;
  
                                          &lt;asp:linkbutton id="btnDelete" runat="server" commandname="Delete" text="Delete" /&gt;
                                  &lt;/itemtemplate&gt;
                                  &lt;edititemtemplate&gt;
                                          &lt;asp:linkbutton id="btnUpdate" runat="server" commandname="Update" text="Update" /&gt;
                                          &lt;asp:linkbutton id="btnCancel" runat="server" commandname="Cancel" text="Cancel" /&gt;
                                  &lt;/edititemtemplate&gt;
                          &lt;/asp:templatefield&gt;
  
  
  
  
  
  &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>my code behind:</p>
  
  <pre><code>public void gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
      {
  
          int bookid = Convert.ToInt32(gv_table1.DataKeys[e.RowIndex].Values["book_id"].ToString());
          string bookname =(gv_table1.Rows[e.NewValues].Cells[1].Controls[0] as TextBox).Text;
          string bookname = (gv_table1.Rows[e.RowIndex].FindControl("author_name") as TextBox).Text;
  
          string book = gv_table1.Rows[e.RowIndex].Cells[1].Text ;
  }
  </code></pre>
  
  <p>I am able to delete but not edit data.I am not able to get the changed values that i enter in the grid view .My best effort got me the value that was in gridview before editing or changing. 
  Thanks in advance friends.</p>