We also want it to be something persistent, so that, for example, if you sort, then page, the sort is maintained.The way we’ll accomplish this is to create two properties that store those values in View State.
Once we have a reference to the Text Box, we set the new last name and save the changes (through the Submit Changes method).When a Bound Field is displaying data (not in edit mode), the appropriate text is added to the Text property of the appropriate cell. NET forums is how to deal with exceptions like The Grid View 'Grid View1' fired event Row Editing which wasn't handled.The Grid View 'Grid View1' fired event Page Index Changing which wasn't handled.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.
Once we have a reference to the Text Box, we set the new first name.
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.
We’ll get to how these properties are populated shortly, but first we need to go back to the Bind Data method.