Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create DTC Checkboxes on the fly 1

Status
Not open for further replies.

bryant89

Programmer
Nov 23, 2000
150
CA
Does anyone know how to create DTC Checkboxes on the fly. I can create regular html checkboxes on the fly. Basically what I want to do is loop through a recordset and create a checkbox based on each record in the recordset. So for instance in the case below I am using a html checkbox. But I want to do the same with a dtc checkbox.
<%do while not rcsAssociationList.EOF %>
<INPUT type=&quot;checkbox&quot; id=chkMemberOf<%=txtAssociationListID.value%> name=&quot;chkMemberOf<%=txtAssociationListID.value%>&quot;>
<% rcsAssociationList.moveNext()%>
<% loop %>

Thanks in advance.
Bryant
 
Try calling the (unbound!) Checkbox DTC's display method in a loop. You will need to inspect the Request.Form items in a loop to extract the ticks.

I have had trouble with checkbox DTC's in a grid, but this is how I got multiple combo boxes to appear in a gridDTC
(requires VI Service Pack 3 or 4 - as the display method can now return the HTML as a string):

1. Add a server-side helper function:

Function showCompetancy(i_intSST_RSN, i_intCompetanceLevel)
' display Combo Select List within the grid cells
' rename each one to include the Soft Skill ID number
' - so that the form can 'save' any changes
'
'**rename each with the identity-column number
'** so record 24 -> cmbSST_0024
cmbCompetenceLevels.name = &quot;cmbSST_&quot; & right(cstr(1000 + i_intSST_RSN), 3)
'** no need to maintain state...
cmbCompetenceLevels.maintainState = false
'** set the combo to the previously selected value...
cmbCompetenceLevels.selectByValue(i_intCompetanceLevel)
'** obtain the HTML code...
cmbCompetenceLevels.show
showCompetancy = cmbCompetenceLevels.display(true)
cmbCompetenceLevels.hide
}


2: In the GridDTC's properties, add a column with the following code:

=showCompetancy([SST_RSN],[ESS_CompetanceLevel])

The two parameters are recordset columns to provide a unique row number (an identity, or autonumber column in your table), and the value that the user previously selected.

3: You need to un-ravel the results in the form processing...

for each itm in Request.Form
if left(itm, 7) = &quot;cmbSST_&quot; then
'get selected combo value
intLevel = Request.Form(itm)
'get table row key (RowSerialNumber-RSN)
intSST_RSN = cint(right(itm, 3))
..YOUR PROCESSING CODE HERE..
.. ie Update CAR
.. SET Colour = [intLevel]
.. WHERE CAR_ROW_KEY = [intSST_RSN]
end if
next

Hope this helps! (Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top