views:

14

answers:

1

i have a listview that is bound to a datatable(not using any custom object to represent the fetched data). How do i create a view so that i can filter,sort the collection. (i tried google and the samples i found were using objects(eg:product) to create views)

sample code:

Private Sub ShowOnlyBargainsFilter(ByVal sender As Object, ByVal e As FilterEventArgs)
            Dim **product** As AuctionItem = TryCast(e.Item, AuctionItem)
            If product IsNot Nothing Then
                ' Filter out products with price 25 or above
                If product.CurrentPrice < 25 Then
                    e.Accepted = True
                Else
                    e.Accepted = False
                End If
            End If
        End Sub

I dont have any object like product as in the above sample. what do i do?

+2  A: 

use the DataTable.DefaultView property and filter sort or do whatever you wanna do

Chen Kinnrot