At that point we need to get the new values so we can update the record, which is done slightly differently for the Bound Field and the Template Field.
For the Bound Field, we don’t know the ID of the Text Box since it’s autogenerated by the Bound Field, so we obtain a reference to it by getting the first control in the appropriate cell in the edited row.
Since it’s a Bound Field, the Text Box is going to be Control.
The important point is not which of these two events call Bind Data, but one of them must or the Grid View will not be updated. When bound using a Data Source ID, the Grid View internally tracks the current Sort Expression and Sort Direction, and those are available through properties with the same names.
When you manually bind the Grid View, this tracking does not occur, so we must implement some mechanism for tracking those values.
We’ll start with binding data to the Grid View, then build up functionality from there.
First, we’ll implement a method to databind the Grid View, which will be called whenever databinding needs to be performed.
We’re using Linq to SQL to pull data from our database and bind it to the Grid View.