Gridview sorting w/CSLADataSource

Gridview sorting w/CSLADataSource

Old forum URL: forums.lhotka.net/forums/t/318.aspx


tfsmag posted on Thursday, June 08, 2006

Here is my select event for my CSLADataSource

    Protected Sub dsGVResults_SelectObject(ByVal sender As Object, ByVal e As CCMSI.Framework.Web.SelectObjectArgs) Handles dsGVResults.SelectObject
        If ddlMemberResults.SelectedValue <> "" Then
            Dim GetValues() As String = ddlMemberResults.SelectedValue.Split(",")
            Dim location As String = GetValues(0)
            Dim member_number As String = GetValues(1)
            Dim TestID As Integer = Convert.ToInt32(GetValues(2))
            Dim assoc As String = GetValues(3)
            Dim Results As LossControl_ListTestResults = LossControl_ListTestResults.Fetch(TestID, assoc, member_number, location)
            e.BusinessObject = Results
        End If
    End Sub

My Gridview is named gvResults, I can bind the gridview and display the data fine. My problem comes when I have sorting enabled, and I click the headers on top of the gridview, nothing happens. I know how to sort from a SQLDataSource but can't seem to figure it out with the CSLADataSource. I should probably add that I'm not an architect and I inherited this framework from previous developers. I'm sure I'll have to use the gvResults_Sorting() event somehow, but haven't been able to do it thus far.

glenntoy replied on Thursday, June 08, 2006

Please refer to this thread http://forums.lhotka.net/forums/thread/538.aspx

Set the GridView.AllowSorting = True

In the CSLADatasource_SelectObject, use GridView.SortExpression and GridView.SortDirection to retrieved the column to sort.

Cheers,

Glenn

Copyright (c) Marimer LLC