I have a GridView with the datasource equal to a datatable. Whne I click on the header row to sort the gridview, the gridview.datasource as no rows. Why?
My code is:
The gridview is populated with 2200+ rows.
Any help is appreciated.
"If it's stupid but works, it isn't stupid."
-Murphy's Military Laws
My code is:
Code:
Private Sub gvNSFs_Sorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)
Dim dt As New DataTable(gvNSFs.DataSource)
Dim dv As New DataView(dt)
lblError.Text = dt.Rows.Count 'returns 0
'dv.Sort = e.SortExpression & " " & convertSortDirection(e.SortDirection)
gvNSFs.DataSource = dv
gvNSFs.DataBind
End Sub
Private Function convertSortDirection(sd As SortDirection)
Dim strSD As String = ""
Select (sd)
Case SortDirection.Ascending
strSD = "ASC"
Case SortDirection.Descending
strSD = "DESC"
End Select
convertSortDirection = strSD
End Function
The gridview is populated with 2200+ rows.
Any help is appreciated.
"If it's stupid but works, it isn't stupid."
-Murphy's Military Laws