title: Getting cell value after selecting a row
body: <p>I have a Gridview with values MachineGroupID, MachineGroupName, MachineGroupDesc and so on..</p>
  
  <p>I have a delete command in the gridview, when I clicked is supposed to delete the selected row.</p>
  
  <p>Now i have a code which tells me which row is selected.</p>
  
  <pre><code> protected void LinkButton1_Click(object sender, EventArgs e)
   {
          LinkButton btn = (LinkButton)sender;
          GridViewRow row = (GridViewRow)btn.NamingContainer;
          string machineID = (String)GridView1.SelectedValue;
          if (row != null)
          {
              LinkButton LinkButton1 = (LinkButton)sender;
  
              // Get reference to the row that hold the button
              GridViewRow gvr = (GridViewRow)LinkButton1.NamingContainer;
  
              // Get row index from the row
              int rowIndex = gvr.RowIndex;
              string str = rowIndex.ToString();
              //string str = GridView1.DataKeys[row.RowIndex].Value.ToString();
              RemoveData(str); //call the delete method
         }
   }
  </code></pre>
  
  <p>I want to get the MachineGroupID present in the row so that i can pass that value and delete the record from the database and the gridview?</p>
  
  <p>Thanks</p>