I'm having trouble with sorting on my gridview column. I've specified the DataType as datetime:
grdPackages.Columns[(int)ServerPackage.Column.Timestamp].DataType = typeof(DateTime);
However, when clicked on, it still does a Text-based sort. Is there anything else I need to do? If I were to change the column to a DateTime column, would this help? How would I go about doing this? It's a databound gridview populated from a list of custom data types.
Also, I'm also getting 'NullReferenceException' errors in my gridview formatting function on the line above, when it's called for a second time. So, the first time the grid is populated, the formatting function is called, and the column is set to typeof(DateTime). After this point, the user clicks elsewhere, causing the gridview's datasource to be set to null. Then, if they return to the same spot, the data is loaded and the formatting function is called again. This time, it throws the nullreferenceexception on that line. I don't understand why this would happen. I've verified that it happens even when the data source is the same...