나는 데 문제에 대한 정렬트. 나는 전문가가 아니에 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