

/ by reflection to access that property in the object to / The constructor sets the PropertyName that is used / This comparer is used to sort the generic comparer We must have a property name for this comparer to work If (p_sortDirection != null & p_sortDirection = "Desc") //Now that we have sorted check to see if the sort direction is desc Public List GetStudentInfo(string p_sortExpression, string p_sortDirection) Public StudentInfo(int intRoll, string strName) I have a Date Field which I can't format in my grid and I think its because its been flattened into a string.Ĭould anyone explain how I could retain the DataTypes or maybe suggest an alternative solution? In VB if possible. It works great except the DataTypes don't appear to be retained. New (ObjectType)ĭim stream As IO.MemoryStream = New IO.MemoryStream() Public Shared Function ToDataSet(ByVal OrigObject As Object, ByVal ObjectType As Type) As DataSetĭim serializer As = _


This method serializes an object and returns its associated DataTable: I thought this might be an easier option and found some I did some digging around and I understand that I can either implement some further methods/properties in my Objects to allow them to be sortable, or I can flatten my list of objects into a DataTable. Automatic sorting is only supported with DataView, DataTable, and DataSet. "The data source 'ObjectDataSource1' does not support sorting with IEnumerable data. This displays fine in the grid, but when I try and sort it I get the following error: I can use an ObjectDataSource with a Select Method "GetAllUsers()" say, which returns a list of Users. I have a BLL and DAL with Custom Objects which I'm trying to display in a grid.
