473,386 Members | 1,883 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,386 software developers and data experts.

Checkboxlist why is this not working

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).select ed = True
<===================Not working

End If

'cbl.items()

'listitem.

i += 1

Next
Dec 2 '06 #1
2 1899
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.
"Mr. SweatyFinger" <sw@sw1finger.comwrote in message
news:u1**************@TK2MSFTNGP02.phx.gbl...
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).select ed = True
<===================Not working

End If

'cbl.items()

'listitem.

i += 1

Next


Dec 3 '06 #2
"Mr. SweatyFinger" <sw@sw1finger.comwrote in message
news:u1**************@TK2MSFTNGP02.phx.gbl...
cbl.items.FindByValue(row.Item(0).tostring).select ed = True
<===================Not working
((CheckBox)cbl.items.FindByValue(row.Item(0).tostr ing)).selected = True
Dec 3 '06 #3

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

Similar topics

1
by: Mats | last post by:
Hi I am working on a webapplication using Asp.net with C#. I have Datagrid that have 3 colums two of them are text but the last one is a CheckBoxList. I have manage to set data to the...
4
by: dm_dal | last post by:
Is there a know issue surrounding the CheckBoxList control and it's viewstate? When my control is created, it's ListItems are checked as needed, but on a postback, they loose their Selected...
3
by: Ed West | last post by:
Hello I am trying to put a CheckBoxList in a DataList but it's not working too great. Is this possible? <asp:datalist id=DataList1 runat="server" RepeatColumns="4"> <HeaderTemplate>...
3
by: Jack Black | last post by:
Using VS.Net 2k3 to build ASP.Net app with VB code-behind pages... Hi, all! I've been struggling with getting a dynamically-generated CheckBoxList generated. I've finally been able to get the...
3
by: Dune | last post by:
Hi, Is there anyway to get the datavaluefield from a databound checkboxlist using javascript? If not, is there any way to associate a custom attribute with the databound checkboxlist items so...
7
by: ThunderMusic | last post by:
Hi, I have a CheckBoxList and I want to add some javascript code to each CheckBox created by this CheckBoxList. I tried iterating through all items of the list, all the controls, do a FindControl,...
0
by: webmaster | last post by:
Hi all, I'm tearing my hair out with this one. I have successfully implemented by own RadioButtonList in order to provide additional functionality and a DIV rather than TABLE-based layout in...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
3
by: dbuchanan | last post by:
How, at rundime, do I capture the fact that the parametrized query that fills a CheckBoxList results in an empty set. When the dataset is empty the CheckBoxList does not appear. I would like to...
3
by: dbuchanan | last post by:
When there are only a few items in the CheckBoxList they are distributed in a sparse maner such as one at top, one in the middle and one at the bottom. Is there any way to have the vertical...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.