After specifying the query, we add the appropriate sorting. When you bind a Grid View through a Data Source ID, the Grid View will update this value since it is internally tracking the sort expression, so it knows when to switch between ascending and descending.We can implement it in this way without a performance impact because the data is not actually retrieved from the database until required, so we can build up a chain of queries up to that point and only the end result will be pulled from the database. When manually databinding the Grid View, this will always show ascending, so we need to handle this manually with the following logic: After that we save the new Sort Expression.NET 2.0 most of the examples and tutorials deal with setting the Data Source ID, which buys you a lot of automation that you may not even appreciate unless you’ve done this the old fashioned way.In this example, we’ll go through a fully featured Grid View with editing, deleting, selecting, sorting, and paging functionality that is manually bound and identify the limitations and some of the workarounds. Sql Data Source, Object Data Source, Linq Data Source, etc) specified in a Data Source ID, the Grid View can automate many functions because, through the data source control, the Grid View on its own can perform the following operations: When you manually bind data to a Grid View, the Grid View itself cannot perform these operations, so they must be implemented in your code.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.
The Grid View Row is the naming container for the Text Box in this case, so we need to call Find Control on the appropriate row, but we do not need to call it on the specific cell.
The Grid View 'Grid View1' fired event Sorting which wasn't handled.