Am o problemă în ceea ce privește Fel în Gridview. Eu nu sunt un expert în vb.net dar trebuie să rezolve această problemă. Vreau să explic modul meu de date este de a veni în 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()
se va încărca de date de interogare de a merge prin unele măsuri
//Această funcție este utilizată pentru o anumită logică
Private Sub loadgrid() Handles B_SEARCH.Click, chkLegacy.CheckedChanged, gvEmployer.PageIndexChanged
GridDataLoader()
End Sub
eEmployer
va primi toate datele pentru interogare pentru 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
în cele din urmă, datele se întoarce în vedere grilă. dar problema mea este ca eu nu am înțelege cum pot pune în aplicare sortare lucru. am schimbat ceva de vedere AllowSorting="true"
SortExpression="EmployerName"
și nu știu ce ar trebui să fac în continuare. Am fost în urma acestei Articel