Late bound sort of gridview

H

Haim Katz

I have a gridview in asp.net 2.0 which is late bound to a datasource
depending upon user selections on the form. The data shows up in the
grid, but clicking on the column headers does not sort the data and
causes it to disappear.

How can I handle the sort so that it works?

Here is the code:
Dim mywhere As String
Dim repview, selectstring As String
Dim myarg As New System.Web.UI.DataSourceSelectArguments()

'select clause that detects which report to load
Select Case Me.ddReptype.SelectedValue
....

Case 3 'Quality
repview = "QualityRepView"

End Select
selectstring = "select * from " & repview


'gets where clause from various dropdownlists
mywhere = getWhereClause()

selectstring += " Where " & mywhere

Me.GridView1.AllowSorting = True

Me.SDSReports.SelectCommand = selectstring
Me.SDSReports.Select(myarg)
Me.GridView1.DataSourceID = "SDSReports"
'Me.GridView1.DataSource = Me.SqlDataSource1


Me.GridView1.DataBind()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top