Murray Brown
asked on
ASP.net Sort GridView by clicking on header
Hi
I am using the following code to populate a GridView in my ASP.net web page.
Is it possible to set up the GridView so that it sorts by a column when the header
of that column is clicked on?
Sub Fill_GridView1(ByVal sSQL As String)
Try
''Dim xSQLAdapter_Search As SqlDataAdapter
''Dim xSQLTable_Search As New DataTable
xSQLTable.Clear()
Dim cs As String = "Server=xxxxxxxxx.co.za;Da tabase=xxx xxxxx"
Dim connection As New SqlConnection(cs)
xSQLAdapter = New SqlDataAdapter(sSQL, connection)
xSQLAdapter.Fill(xSQLTable )
Me.GridView1.DataSource = xSQLTable
Me.GridView1.DataBind()
Catch ex As Exception
MsgBox(ex.Message & " 051h")
End Try
End Sub
I am using the following code to populate a GridView in my ASP.net web page.
Is it possible to set up the GridView so that it sorts by a column when the header
of that column is clicked on?
Sub Fill_GridView1(ByVal sSQL As String)
Try
''Dim xSQLAdapter_Search As SqlDataAdapter
''Dim xSQLTable_Search As New DataTable
xSQLTable.Clear()
Dim cs As String = "Server=xxxxxxxxx.co.za;Da
Dim connection As New SqlConnection(cs)
xSQLAdapter = New SqlDataAdapter(sSQL, connection)
xSQLAdapter.Fill(xSQLTable
Me.GridView1.DataSource = xSQLTable
Me.GridView1.DataBind()
Catch ex As Exception
MsgBox(ex.Message & " 051h")
End Try
End Sub
ASKER
Thanks but not looking for a web forms DataGridView but rather a ASP.net GridView
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much
please check the code samples on this page. There are at least 2 options available to you here.
manual-sorting-for-gridvie
MS also have a sample..
headermouseclick