Problem using custom paging

G

Guest

Trying to page results from a repeater. The resulting hyperlinks point o
empty references when the page is run. No errors show up

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here


'Dim partoftown = Session("partoftown")
' Dim partoftown = "kensington"

Dim conPubs As SqlConnection
Dim cmdSelect As SqlCommand
Dim dtrAuthors As SqlDataReader


Dim objConn As SqlConnection = New SqlConnection("Data
Source=server1;Initial Catalog=findandview;trusted_connection=true;")
Dim objCommand As SqlDataAdapter = New SqlDataAdapter("Select *
from maintable where area = 'Kensington'", objConn)


Dim ds As DataSet = New DataSet
objCommand.Fill(ds)

Dim objPds As PagedDataSource = New PagedDataSource
objPds.DataSource = ds.Tables(0).DefaultView
objPds.AllowPaging = True
objPds.PageSize = 5
Dim CurPage As Integer
If Not Request.QueryString("Page") Is Nothing Then
CurPage = Convert.ToInt32(Request.QueryString("Page"))
Else
CurPage = 1
End If

objPds.CurrentPageIndex = CurPage - 1
lblCurrentPage.Text = "Page: " + CurPage.ToString()

If Not objPds.IsFirstPage Then
lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath +
"?Page=" + Convert.ToString(CurPage - 1)
End If

If Not objPds.IsLastPage Then
lnkNext.NavigateUrl = Request.CurrentExecutionFilePath +
"?Page=" + Convert.ToString(CurPage + 1)
End If

Repeater1.DataSource = objPds
Repeater1.DataBind()
End Sub

....
in ASP

<td valign="top" align="right" width="82"><asp:HyperLink id="lnkPrev"
runat="server"><img src="../buttons/previous_button_06.gif" width=82
height=22></asp:HyperLink></td>

<td width="82" valign="top" align="left"><asp:HyperLink id="lnkNext"
runat="server"><img src="../buttons/next_button_06.gif" width=82
height=22></asp:HyperLink></td>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,585
Members
45,080
Latest member
mikkipirss

Latest Threads

Top