Help with CheckBoxlist!

P

Patrick.O.Ige

I have a Checkboxlist that is databinded and i want to pass it a boolean
value from a table because i want
to display the checked values if its TRUE.

When Databinding my checkboxlist i'm not passing the column name with the
boolean values to the DataValueField
which is the column "checked" but instead i want to loop through the
checkboxlist and pass the Boolean values to it like so below
But it seems not to work.!!!
Any ideas??
Some one suggested to use a Repeater with a checkbox but hoping to get more
Help?
chkDebtor.DataSource = objDR

chkDebtor.DataValueField = "DebtorCodeID"

chkDebtor.DataTextField = "DebtorCode"

chkDebtor.DataBind()


Dim currentCheckBox As ListItem
For Each currentCheckBox In chkDebtor.Items
While objReader.Read

If Not (currentCheckBox Is Nothing) Then
'If currentCheckBox Is Nothing Then
'I tried passing the Boolean checkBox selected to a boolean here
currentCheckBox.Selected = CBool(objReader("checked"))

'Prints out the boolean value to check
Response.Write("<b>" & CBool(objReader("checked")) & "</b>")

End If
End While

Next
 
G

Guest

Patrick,

A workaround using Datalist , instead of Checkboxlist is posted as reply to
u r previous post
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top