Private Property GridViewPageIndex() As Integer
Get
If ViewState("GridViewPageIndex") IsNot Nothing Then
Return ViewState("GridViewPageIndex")
End If
Return 0
End Get
Set(ByVal value As Integer)
ViewState("GridViewPageIndex") = value
End Set
End Property
Private Property GridViewSortDirection() As SortDirection
Get
If ViewState("sortDirection") Is Nothing Then
ViewState("sortDirection") = SortDirection.Ascending
End If
Return ViewState("sortDirection")
End Get
Set(ByVal value As SortDirection)
ViewState("sortDirection") = value
End Set
End Property
Private Property GridViewSortExpression() As String
Get
If String.IsNullOrEmpty(ViewState("sortExpression")) Then
ViewState("sortExpression") = DBConstants.COL_HISTORICALTRANSACTIONLOG_ID
End If
Return ViewState("sortExpression")
End Get
Set(ByVal value As String)
ViewState("sortExpression") = value
End Set
End Property
Private Sub ApplyFilter(ByVal direction As String)
Dim dt As Ril.HistoricalTransactionLogTable = _
Ril.TransactionManager.GetHistoricalTransactionLogs(QueryClauseCollectionParameter)
Dim dv As New Data.DataView(dt)
dv.Sort = GridViewSortExpression + " " + direction
gvTransactions.DataSource = dv
gvTransactions.PageIndex = GridViewPageIndex
gvTransactions.DataBind()
End Sub
Protected Sub gvTransactions_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvTransactions.PageIndexChanged
If GridViewSortDirection = SortDirection.Ascending Then
ApplyFilter("ASC")
Else
ApplyFilter("DESC")
End If
End Sub
Protected Sub gvTransactions_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvTransactions.PageIndexChanging
GridViewPageIndex = e.NewPageIndex
End Sub
Protected Sub gvTransactions_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles gvTransactions.Sorting
GridViewSortExpression = e.SortExpression
End Sub
Protected Sub gvTransactions_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvTransactions.Sorted
If GridViewSortDirection = SortDirection.Ascending Then
GridViewSortDirection = SortDirection.Descending
ApplyFilter("DESC")
Else
GridViewSortDirection = SortDirection.Ascending
ApplyFilter("ASC")
End If
End Sub