Datagrid Sorting

Results 1 to 2 of 2

Thread: Datagrid Sorting

  1. #1
    Join Date
    Dec 1969

    Default Datagrid Sorting

    I would like to know if there is anyway we can do a sorting of the Datagrid columns by retreiving the datasource and doing an order by on that Datasource instead of having to make a call to the DB that appends the appropriate ORDER BY clause to the SQL that changes the dataset returned back to the datagrid.<BR><BR>Basically I wnat to figure out if it is possible to implement Datagrid sorting without having to perform a Database hit every time a sort operation is done.<BR><BR>Any ideas? <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Datagrid Sorting

    Yes, set the AllowSorting property to true. Make datatable your data source and put it in ViewState. Write code on the SortCommand event to get the SortExpression of DataGridSortCommandEventArgs. Make use of the Sort property of the dataview to sort and bind the data.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts