473,404 Members | 2,179 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,404 software developers and data experts.

CheckBoxList Question

Hi,

I have a question on checkboxlist, suppose I have a checkboxlist and has
listitems like
USA
Canada
UK
Germany
Australia
Suppose I have a resultset that has values (USA, UK and Australia)
How can set the values in the checkboxlist to selected/enabled?

Thanks,
Stephen
Dec 1 '05 #1
3 1076
Stephen are you interested in getting the selectedItem.Value of the
Checkboxlist?
Maybe try posting some snippet code.
Patrick

"Stephen" <st********@hotmail.com> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a question on checkboxlist, suppose I have a checkboxlist and has
listitems like
USA
Canada
UK
Germany
Australia
Suppose I have a resultset that has values (USA, UK and Australia)
How can set the values in the checkboxlist to selected/enabled?

Thanks,
Stephen

Dec 2 '05 #2
Hi Patrick,

Thanks for the info, actually I have a Solution but please do let me know if
there is a better way of doing it. This is how I approached it. I loop
through the dataset and check for the column that corresponds to the one
that has to be linked/matched to the checkbox and if it matched
then.selected = true

For iSystems = 0 To dsSystems.Tables(0).Rows.Count - 1
If dsSystems.Tables(0).Rows(iSystems)(1).ToString = "Canada" Then
For iChkBox = 0 To chkBoxCanada.Items.Count - 1
If chkBoxCanada.Items(iChkBox).Value =
dsSystems.Tables(0).Rows(iSystems)(0).ToString Then
chkBoxCanada.Items(iChkBox).Selected = True

End If

Next

End If
Next

Is there a better way of doing this?
Thanks,
Stephen
"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Stephen are you interested in getting the selectedItem.Value of the
Checkboxlist?
Maybe try posting some snippet code.
Patrick

"Stephen" <st********@hotmail.com> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a question on checkboxlist, suppose I have a checkboxlist and has
listitems like
USA
Canada
UK
Germany
Australia
Suppose I have a resultset that has values (USA, UK and Australia)
How can set the values in the checkboxlist to selected/enabled?

Thanks,
Stephen


Dec 2 '05 #3
Good approach

"Stephen" <st********@hotmail.com> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
Hi Patrick,

Thanks for the info, actually I have a Solution but please do let me know if there is a better way of doing it. This is how I approached it. I loop
through the dataset and check for the column that corresponds to the one
that has to be linked/matched to the checkbox and if it matched
then.selected = true

For iSystems = 0 To dsSystems.Tables(0).Rows.Count - 1
If dsSystems.Tables(0).Rows(iSystems)(1).ToString = "Canada" Then
For iChkBox = 0 To chkBoxCanada.Items.Count - 1
If chkBoxCanada.Items(iChkBox).Value =
dsSystems.Tables(0).Rows(iSystems)(0).ToString Then
chkBoxCanada.Items(iChkBox).Selected = True

End If

Next

End If
Next

Is there a better way of doing this?
Thanks,
Stephen
"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Stephen are you interested in getting the selectedItem.Value of the
Checkboxlist?
Maybe try posting some snippet code.
Patrick

"Stephen" <st********@hotmail.com> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a question on checkboxlist, suppose I have a checkboxlist and has listitems like
USA
Canada
UK
Germany
Australia
Suppose I have a resultset that has values (USA, UK and Australia)
How can set the values in the checkboxlist to selected/enabled?

Thanks,
Stephen



Dec 4 '05 #4

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

Similar topics

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...
4
by: Shaul Feldman | last post by:
Hello, I have something really awkward at work - fighting with CheckBoxList... How can I define CSS for ListItem in CheckBoxList programmatically. I add CheckBoxList's Items on the fly, something...
7
by: bienwell | last post by:
Hi, I'm using the CheckBoxList control in ASP.NET for Web development. This checkboxlist is bound by the database. If we have more items for this checkbox list, it takes space on the page. I...
5
by: Patrick.O.Ige | last post by:
I'm binding a CheckBoxlist below in the ItemDataBound(the CheckBoxList is in a Datalist) By doing "li.Selected = True" i can see all the checkBoxes are selected. But what i want is to be able...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
0
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView...
0
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView...
2
by: clintonG | last post by:
When selected="true" is declared in the CheckBoxList ListItem FireFox does not display checked list items. Even more curious is the absence of the checked="checked" attribute in the source which is...
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?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.