Sort with datagrid

  • Thread starter Thread starter Garry Dawkins
  • Start date Start date
G

Garry Dawkins

I have a page that list table info(Title field, etc...) that needs to be
sorted on demand. The alphabet is across the top of the page and by
clicking a letter the table needs to be sorted that way.

GDawkins
 
Private Sub dg_PageIndexChanged(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles
dg.PageIndexChanged
dg.CurrentPageIndex = e.NewPageIndex
dg.DataBind()
End Sub

Private Sub dg_SortCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
dg.SortCommand
Dim dv As New DataView(dsCusts.Tables(0))
dv.Sort = e.SortExpression
dg.DataSource = dv
dg.DataBind()
End Sub
 
Back
Top