B
Brock
I have a successfully functioning DataGrid that I'd like to add
sorting capabilities to. No editing is allowed to the data. As it
stands I have 4 columns of data "Emp #", "Last Name", "First Name",
and "Title". Each of these displays also as the names of the column
headers displayed. How can I using my working code below add sorting
functionality that allows the users to click the column name and with
each click produce a sort? The datagrid would default to Emp #, but
either of the four columns could be made to sort. each click would
alternate between ASC and DESC order with ASC being the default.
Thanks for any clues! Brock
Private Sub SetListViewItem(ByVal dr As Employee, ByVal dt As
DataTable, ByVal count As Integer)
If count = 0 Then
dt.Columns.Add("Emp #")
dt.Columns.Add("Last Name")
dt.Columns.Add("First Name")
dt.Columns.Add("Title")
End If
Dim EmpPos As Action = (New
ActionBroker).GetActionCurrent(dr.Key, Today, Global.UserName,
Global.UserPassword, Global.appDataSource)
Dim employee As DataRow = dt.NewRow
employee("Emp #") = dr.Key
employee("Last Name") = dr.LastName
employee("First Name") = dr.FirstName
employee("Title") = EmpPos.WorkAgainstInfo.Title
dt.Rows.Add(employee)
End Sub 'SetListViewItem
sorting capabilities to. No editing is allowed to the data. As it
stands I have 4 columns of data "Emp #", "Last Name", "First Name",
and "Title". Each of these displays also as the names of the column
headers displayed. How can I using my working code below add sorting
functionality that allows the users to click the column name and with
each click produce a sort? The datagrid would default to Emp #, but
either of the four columns could be made to sort. each click would
alternate between ASC and DESC order with ASC being the default.
Thanks for any clues! Brock
Private Sub SetListViewItem(ByVal dr As Employee, ByVal dt As
DataTable, ByVal count As Integer)
If count = 0 Then
dt.Columns.Add("Emp #")
dt.Columns.Add("Last Name")
dt.Columns.Add("First Name")
dt.Columns.Add("Title")
End If
Dim EmpPos As Action = (New
ActionBroker).GetActionCurrent(dr.Key, Today, Global.UserName,
Global.UserPassword, Global.appDataSource)
Dim employee As DataRow = dt.NewRow
employee("Emp #") = dr.Key
employee("Last Name") = dr.LastName
employee("First Name") = dr.FirstName
employee("Title") = EmpPos.WorkAgainstInfo.Title
dt.Rows.Add(employee)
End Sub 'SetListViewItem