title: ASP .NET RowUpdating GridView Troubles
body: <p>I'm having trouble with the <code>RowUpdating</code> Method.  My <code>GridView</code> is connected to our local SQL Server, and I'm trying to update the data. Here is the code for the <code>RowUpdating</code> Method from MSDN.</p>
  
  <pre><code>protected void TaskGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
  {
          //Retrieve the table from the session object.
          DataTable dt = (DataTable)Session["TaskTable"];
  
          //Update the values.
          GridViewRow row = GridView1.Rows[e.RowIndex];
          dt.Rows[row.DataItemIndex]["Id"] = ((TextBox)(row.Cells[1].Controls[0])).Text;
          dt.Rows[row.DataItemIndex]["Description"] = ((TextBox)(row.Cells[2].Controls[0])).Text;
          dt.Rows[row.DataItemIndex]["IsComplete"] = ((CheckBox)(row.Cells[3].Controls[0])).Checked;
  
          //Reset the edit index.
          GridView1.EditIndex = -1;
  
          //Bind data to the GridView control.
          BindData();
  
  }
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>System.NullReferenceException: Object reference not set to an instance of an object. </p>
  </blockquote>