我有一个问题,关于排序在。 我不是专家vb.net 但我必须要解决这个问题。 我想解释一下我的数据是进来。
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
//also there is some logic in there but I think that part of the code will not effect
loadgrid()
End Sub
loadgrid()
将载于所查询的数据通过一些步骤,
//这种功能使用一些逻辑
Private Sub loadgrid() Handles B_SEARCH.Click, chkLegacy.CheckedChanged, gvEmployer.PageIndexChanged
GridDataLoader()
End Sub
eEmployer
将获得的所有数据的查询内
Public Sub GridDataLoader()
//some code was there because of searching
Dim dataTable = Employer.getEmployers(eEmployer, chkLegacy.Checked)
gvEmployer.DataBind()
End Sub
Public Function GetEmployers(ByVal eEmployer As tblEmployer, ByVal All As Boolean, Optional ByVal sortExpression As String = Nothing) As DataTable
Dim query = ""
query =
"select employer.EmployerID as EmployerId,
employer.Employer_Name as EmployerName,
// the query is so large so i delete all for better understanding
on (employer.Modified_by=tum.UserID)
where employer.LegacyID IS NULL and address.ValidityTo is null"
'End If
Dim params = ""
If All = False Then
query += " AND employer.ValidityTo is null"
End If
If (params.Trim() IsNot "") Then
query = query & params
End If
data.setSQLCommand(query, CommandType.Text)
Return data.Filldata
End Function
最后,数据是返回到网格图。 但是我的问题是我不理解我如何可以实现的排序的事情。 我改变了一些东西被视 AllowSorting="true"
SortExpression="EmployerName"
我不知道我应该怎么做进一步。 我是以下这 Articel