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()
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()