|
Imports System.Collections.Generic
Imports CollectionSorter
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub BtnSortAsc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSortAsc.Click
Dim BookList As List(Of Book) = New List(Of Book)
Dim m_book As Book
m_book = New Book()
m_book.Author = "Bill Gates"
m_book.Title = "How to get rich as software engineer!"
m_book.PublishDate = "1/1/2000"
BookList.Add(m_book)
m_book = New Book()
m_book.Author = "Steve Job"
m_book.Title = "Why apple went down the drain!"
m_book.PublishDate = "1/1/2007"
BookList.Add(m_book)
Dim colsorter As CollectionSorter(Of Book) = New CollectionSorter(Of Book)("Author asc")
BookList.Sort(colsorter)
grdTest.DataSource = BookList
grdTest.DataBind()
End Sub
Protected Sub btnSortDesc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSortDesc.Click
Dim BookList As List(Of Book) = New List(Of Book)
Dim m_book As Book
m_book = New Book()
m_book.Author = "Bill Gates"
m_book.Title = "How to get rich as software engineer!"
m_book.PublishDate = "1/1/2000"
BookList.Add(m_book)
m_book = New Book()
m_book.Author = "Steve Job"
m_book.Title = "Why apple went down the drain!"
m_book.PublishDate = "1/1/2007"
BookList.Add(m_book)
Dim colsorter As CollectionSorter(Of Book) = New CollectionSorter(Of Book)("Author desc")
BookList.Sort(colsorter)
grdTest.DataSource = BookList
grdTest.DataBind()
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.