CreateChildControls
Programmatically Created GridView not Sorting
There have been times when I needed to programmatically create a DataGrid in the code behind. Perhaps this was a server control, WebPart, or just a regular page. In some case, I have found that sorting will not work on the GridView when it is programmatically created. This is usually caused by when the controls…