Checkboxlist why is this not working

  • Thread starter Mr. SweatyFinger
  • Start date
M

Mr. SweatyFinger

Dim adapter As New System.Data.OleDb.OleDbDataAdapter(cmd, conn)

Dim ds As New System.Data.DataSet

adapter.Fill(ds)

Dim row As System.Data.DataRow

Dim i As Integer

Dim catName As String

For Each row In ds.Tables(0).Rows

catName = row.Item(0)

Response.Write(catName & "<br>")

Dim cbl As CheckBoxList = formview1.FindControl("CheckBoxList1")

If Not cbl.items.FindByValue(row.Item(0).tostring) Is Nothing Then

cbl.items.FindByValue(row.Item(0).tostring).selected = True
<===================Not working

End If

'cbl.items()

'listitem.

i += 1

Next
 
O

OHM

You dont really say, what error you are getting. Take things a step at a
time.

Does your list box contain the element you are searching for ?
You can check this by right clicking over the rendered web page displayed in
your browser and choosing view source. look for the rendered control data
and see if the value is actually there.

If not then thats one, thing, if it is, then we need to ook further into it.
 
M

Mark Rae

cbl.items.FindByValue(row.Item(0).tostring).selected = True
<===================Not working

((CheckBox)cbl.items.FindByValue(row.Item(0).tostring)).selected = True
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top