Sto avendo un problema per quanto riguarda l'Ordinamento nella Gridview. Io non sono un esperto in vb.net ma devo risolvere questo problema. Voglio spiegare come la mia data è venuta in 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()
sarà carico per la query di dati attraverso alcuni passaggi
//Questa funzione viene utilizzata per un po ' di logica
Private Sub loadgrid() Handles B_SEARCH.Click, chkLegacy.CheckedChanged, gvEmployer.PageIndexChanged
GridDataLoader()
End Sub
eEmployer
avere tutti i dati per la query per 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
infine, i dati di tornare in vista griglia. ma il mio problema è che non ho la comprensione di come posso implementare l'ordinamento cosa. ho cambiato qualcosa è vista AllowSorting="true"
SortExpression="EmployerName"
e non so cosa devo fare di più. Stavo seguendo questo Articolo