Partial Class affiliatecomm
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Response.CacheControl = "private"
'Response.Expires = 0
'Response.AddHeader("pragma", "no-cache")
End Sub
Protected Sub btnGetAffCommData_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetAffCommData.Click
Me.PopulateAffSummData()
End Sub
Protected Sub PopulateAffSummData()
Dim ds As DataSet = DB.GetDS("dbo.AffCommDueSummary", False)
If ds.Tables(0).Rows.Count > 0 Then
Me.gvCommSummary.DataSource = ds.Tables(0)
Me.gvCommSummary.DataBind()
End If
End Sub
Private Function ConvertSortDirectionToSql(ByVal sortDirection As SortDirection) As String
Dim NewSortDirection As String = String.Empty
Select Case sortDirection
Case sortDirection.Ascending
NewSortDirection = "ASC"
Case sortDirection.Descending
NewSortDirection = "DESC"
Case Else
NewSortDirection = ""
End Select
Return NewSortDirection
End Function
Protected Sub gvCommSummary_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvCommSummary.PageIndexChanging
Me.PopulateAffSummData()
gvCommSummary.PageIndex = e.NewPageIndex
gvCommSummary.DataBind()
End Sub
Protected Sub gvCommSummary_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles gvCommSummary.Sorting
Me.PopulateAffSummData()
Dim dt As DataTable = gvCommSummary.DataSource
If Not dt Is Nothing Then
Dim dataView As DataView = New DataView(dt)
dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection)
gvCommSummary.DataSource = dataView
gvCommSummary.DataBind()
End If
End Sub
End Class
|