ฉันกำลังจะมีปัญหาเกี่ยวกับก็อยู่ใน Gridview. ฉันไม่ใช่ผู้เชี่ยวชาญด้านใน vb.net แต่ฉันต้องแก้ปัญหานี้ ฉันอยากจะอธิบายเรื่องข้อมูลของฉันกำลังอยู่ใน GridView.
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
จะได้ข้อมูลทั้งหมดสำหรับการค้นหาสำหรับ gridView
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