The gridview fired event rowupdating which wasnt handled
We’re using Linq to SQL to pull data from our database and bind it to the Grid View.
We’ll revisit this method when we implement the sorting functionality.
When the Bound Field is in Edit mode, things are a little different.
In that case a Text Box is created and added to the Controls collection for the appropriate cell (and it's the only item added to the Controls collection, so it's Controls).
Since it’s a Bound Field, the Text Box is going to be Control.
When a Bound Field is displaying data (not in edit mode), the appropriate text is added to the Text property of the appropriate cell.
In addition to that, we’re resetting the Edit Index and Selected Index when the page is changed to avoid cases, for example, where you change pages and are suddenly editing a different item.
Bind Data could be called in Page Index Changing, but to show that it the event is raised, we’ve handled that in Page Index Changed.
In both cases, the controls are added to the controls collection for the cell.
You can see that in the case of a Template Field, the exact spacing within the control becomes significant, so it’s generally better to get a reference to the control by ID using Find Control than to use the Controls collection.
We’ll get to how these properties are populated shortly, but first we need to go back to the Bind Data method.