473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Non-DataGrid Paging Help

I read and tried to use the repeater paging method I found on 4 Guys from
Rolla (I've tried others also) but it doesn't seem to work. Please see the
code I have below and tell me what I may be doing wrong. I'm using Visual
Studio with SQL 2000. This is question/answer page that loads questions &
answers dynamically. I would like to present 1 question at a time instead of
all questions on one page as quizzes may have up to 50 questions. Can any
one help????

Imports System.Data.OleDb
Imports System.Data

Public Property CurrentPage() As Integer
Get
' look for current page in ViewState
Dim o As Object = Me.ViewState("_CurrentPage")
If o Is Nothing Then
Return 0 ' default to showing the first page
End If
End Get

Set(ByVal Value As Integer)
Me.ViewState("_CurrentPage") = value
End Set
End Property

Private Sub ItemsGet()
' Read sample item info from XML document into a DataSet
Dim Items As New DataSet
Dim DBCommand As OleDbDataAdapter
Dim DBConn As OleDbConnection
Dim objPds As New PagedDataSource
Dim I As Integer
Dim J As Integer
Dim TempID As String

'Connection string goes here.

DBCommand = New OleDbDataAdapter _
("Select SectionQuestionID, QuestionText " _
& "From SectionQuestions Where CourseSectionID = " _
& Session("CourseSectionID"), DBConn)
DBCommand.Fill(Items, "QuizQuestions")

---->Problem 1:
'Data container loads selection from above query ("QuestionText") but not for
the other query on this page.

'Loads questions
For I = 0 To Items.Tables("QuizQuestions").Rows.Count - 1
Dim lcHTML = New LiteralControl
lcHTML.Text = "<b>
" _
& Items.Tables("QuizQuestions").Rows(I).Item("Questi onText") & "</b>
"

TestRptr.Controls.Add(lcHTML)

Dim MyDDL = New RadioButtonList

TempID = Items.Tables("QuizQuestions").Rows(I).Item("Sectio nQuestionID")
MyDDL.ID = "Q" & TempID

DBCommand = New OleDbDataAdapter _
("Select AnswerText " _
& "From QuestionAnswers Where SectionQuestionID = " _
& TempID, DBConn)
DBCommand.Fill(Items, TempID)

---->Problem 2:
'Data Container does not recognize the above query and gives "not part of
QuizQuestions (first query on page) table" error when try to retrieve
AnswerText

'Loads Answers
For J = 0 To Items.Tables(TempID).Rows.Count - 1

Dim MyItem = New ListItem
MyItem.Text = Items.Tables(TempID).Rows(J).Item("AnswerText")
MyDDL.Items.Add(MyItem)

Next
TestRptr.Controls.Add(MyDDL)

Dim lcHTML2 = New LiteralControl
lcHTML2.Text = "

"
TestRptr.Controls.Add(lcHTML2)
Next
' Populates the repeater control with the Items DataSet
'Dim objPds As New PagedDataSource
objPds.DataSource = Items.Tables(0).DefaultView
objPds.AllowPaging = True
objPds.PageSize = 1

objPds.CurrentPageIndex = CurrentPage

lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of " +
objPds.PageCount.ToString()

' Disable Prev or Next buttons if necessary
PrevBtn.Enabled = Not objPds.IsFirstPage
NextBtn.Enabled = Not objPds.IsLastPage

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

Finally: The above code runs, the lblCurrenPage and Prev and Next buttons
appear as they should but do not move to next record(page). Also as mentioned
above only the QuestionText appears not the AnswerText. Help --- please!!!!!

--
Gracias in Advance!
Nov 21 '05 #1
0 1044

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: lothar | last post by:
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few...
5
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence...
3
by: Mario | last post by:
Hello, I couldn't find a solution to the following problem (tried google and dejanews), maybe I'm using the wrong keywords? Is there a way to open a file (a linux fifo pipe actually) in...
25
by: Yves Glodt | last post by:
Hello, if I do this: for row in sqlsth: ________pkcolumns.append(row.strip()) ________etc without a prior:
32
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
14
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
0
by: amitvps | last post by:
Secure Socket Layer is very important and useful for any web application but it brings some problems too with itself. Handling navigation between secure and non-secure pages is one of the cumbersome...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
12
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.