|
Imports System
Imports System.Data
Partial Class gallary
Inherits System.Web.UI.Page
#Region " Data Members "
Dim objPropertyForSale As New Propertyforsale
#End Region
#Region " Page Events "
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
''To set page nuber after redirecting back from detail page
If Request.QueryString("iPn") <> Nothing Or IsNumeric(Request.QueryString("iPn")) Then
gvListProperty.PageIndex = CInt(Request.QueryString("iPn"))
End If
Call BindPropertyGallary()
End If
End Sub
Protected Sub gvListProperty_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvListProperty.PageIndexChanging
gvListProperty.PageIndex = e.NewPageIndex
Call BindPropertyGallary()
End Sub
#End Region
#Region " Functions "
Public Sub BindPropertyGallary()
Dim dsProperty As DataSet
With objPropertyForSale
'-- For Sale -- link button text binding
.AdsCategoryValue = ViewState("AdsCategoryValue")
dsProperty = .Gallaryview_PropertyList()
If dsProperty.Tables(0).Rows.Count > 0 Then
Call DataTableBind(dsProperty)
End If
End With
End Sub
Public Sub DataTableBind(ByVal dsProperty As DataSet)
'-- Paging Variables --'
'Due to Paging Counter == 40 Records per page
Dim iCountIncre As Integer = 40 ' Records per page
Dim iPn As Integer = 0 'Current Page Number
Dim sAds As String
'-- End Paging Variables --'
Dim iCount As Integer
Dim iColumn As Integer = 1
Dim dtTable As New DataTable
Dim dtCol As DataColumn
Dim dtRow As DataRow
dtCol = New DataColumn("Column1")
dtTable.Columns.Add(dtCol)
dtCol = New DataColumn("Column2")
dtTable.Columns.Add(dtCol)
dtCol = New DataColumn("Column3")
dtTable.Columns.Add(dtCol)
dtCol = New DataColumn("Column4")
dtTable.Columns.Add(dtCol)
dtRow = dtTable.NewRow
If ViewState("AdsCategoryValue") = "For sale" Then
sAds = "s"
ElseIf ViewState("AdsCategoryValue") = "For rent" Then
sAds = "r"
ElseIf ViewState("AdsCategoryValue") = "For Condossale" Then
sAds = "c"
End If
For iCount = 0 To dsProperty.Tables(0).Rows.Count - 1
If (iCount + 1) > iCountIncre Then
iCountIncre = iCountIncre + 40
iPn = iPn + 1
End If
dtRow("Column" & iColumn) = "<a href='fulladdforrent.aspx?sAds=" & sAds & "&iPn=" & iPn.ToString & "&QCD=GLV&QID=" & dsProperty.Tables(0).Rows(iCount).Item("iPropertyID") & "' class='txt-grey'> <img src='../Images/Property/thumb/" & dsProperty.Tables(0).Rows(iCount).Item("sImageName") & "' border='0' alt='Vis'/>"
iColumn = iColumn + 1
If iColumn = 5 Then
dtTable.Rows.Add(dtRow)
dtRow = dtTable.NewRow
iColumn = 1
End If
If iCount = dsProperty.Tables(0).Rows.Count - 1 And iColumn <= 5 Then
dtTable.Rows.Add(dtRow)
dtRow = dtTable.NewRow
End If
Next
Dim ds As New DataSet
ds.Tables.Add(dtTable)
gvListProperty.DataSource = ds
gvListProperty.DataBind()
End Sub
#End Region
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.