Sorting on GridView

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mahesh123
    New Member
    • Oct 2007
    • 64

    Sorting on GridView

    Hi,

    I am using gridview in my form and binded the gridview with object datasource.I am trying to implement sorting for my grid view and i am getting following error.i am using asp.net with VB


    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    The data source 'objdsDataSourc e' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NotSuppo rtedException: The data source 'objdsDataSourc e' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.



    Can any one please help me how to solve this Problem

    Thanks
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Looks like you are using the wrong datasource in your code. HTH.

    Comment

    • Brad Orders
      New Member
      • Feb 2008
      • 21

      #3
      I would suggest sorting the DataSet or DataTable before setting it as the DataSource.

      Personally, I try and do any sorting as close as possible to the data. So if it is from a database, I would generally sort in the Stored Procedure, and so I avoid having to deal with this problem.

      HTH. If you are still having a problem, please post some code.

      Good luck

      Comment

      Working...