Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Beginner
Mar 24, 1997

Selecting multiple rows

Question:
I want to let the user select more than one row in a repeater so my application can act on all of them at one time?

Answer:
A repeater control does not allow you to select more than one row at a time. But a repeater control is built on an underlying recordset. You can use the recordset and an unbound object in the repeater to give the user a way to select more than one row.

Every object in a repeater has a column in the recordset for the repeater, including any unbound objects. Power Objects adds columns for unbound objects to the recordset after all the bound columns and the ROWID column, and Power Objects does not give a title to unbound columns, so that you have to reference the column by its position in the recordset.

In order to let a user select multiple rows, you can add an object, such as a check box, that will let the user indicate that row is selected. If you were to use a check box with the name of checkbox1 to a repeater named repeater1 and the column for the check box was the fifth column in the recordset, you could access the value of the check box with the code:

repeater1.GetRecordset().GetColVal(5)

To find all the rows selected with the check box, you would use looping code like this:

DIM nRows AS Integer, nPointer AS Integer
nRows = repeater1.GetRecordset().GetRowCount()
nPointer = 1
DO WHILE nPointer <= nRows
   IF repeater1.GetRecordset().GetColVal(5) THEN
      selected actions
   END IF
   nPointer = nPointer + 1
LOOP
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap