title: How to avoid reloading GridView data every postback?
body: <p>I have a GridView which loads some data on Load like this:</p>
  
  <pre><code>protected override void OnLoad(EventArgs e)
      {
          base.OnLoad(e);
  
          if (!Page.IsPostBack)
          {
              DataTable dataSource = LoadObjects();
              gvObjects.DataSource = dataSource;
          }
      }
  </code></pre>
  
  <p>I've also added a SelectedIndexChanged event handler where I want to perform some functions whenever a row is selected. The problem is that unless I remove the IsPostBack check from the OnLoad method, when a row is selected the GridView.SelectedRow attribute is not the row I selected.</p>
  
  <p>Ideally I don't want to load all my data from the database on each postback. Are there any best-practices to get the selected row during the SelectedIndexChanged  event without reloading everything again?</p>
  
  <p>Thanks.</p>