title: ASP.NET Gridview with Select and its ID being visible or hidden
body: <p>Using a GridView, I have it so that when the "select" link for the row is clicked, the item (in this case "category") is put into a text box to be renamed or edited in some way.</p>
  
  <p>However, in order to save it, I need the ID of the selected row. I can get the ID if I show it as a column and do this in the CategoryGridView_SelectedIndexChanged event:</p>
  
  <pre><code>GridViewRow row = CategoryGridView.SelectedRow;
  
  Session["SelectedID"] = row.Cells[2].Text;
  </code></pre>
  
  <p>However, I don't like that I have to display the ID column because of aesthetic reasons and also I just don't like people seeing my IDs.</p>
  
  <p>On the other hand, if I hide the ID column in the GridView, how can I associate the Category text back to the original row in the Database?</p>