473,661 Members | 2,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1086
Stephen are you interested in getting the selectedItem.Va lue of the
Checkboxlist?
Maybe try posting some snippet code.
Patrick

"Stephen" <st********@hot mail.com> wrote in message
news:uT******** ******@TK2MSFTN GP12.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.Table s(0).Rows.Count - 1
If dsSystems.Table s(0).Rows(iSyst ems)(1).ToStrin g = "Canada" Then
For iChkBox = 0 To chkBoxCanada.It ems.Count - 1
If chkBoxCanada.It ems(iChkBox).Va lue =
dsSystems.Table s(0).Rows(iSyst ems)(0).ToStrin g Then
chkBoxCanada.It ems(iChkBox).Se lected = True

End If

Next

End If
Next

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

"Stephen" <st********@hot mail.com> wrote in message
news:uT******** ******@TK2MSFTN GP12.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********@hot mail.com> wrote in message
news:uh******** ******@TK2MSFTN GP11.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.Table s(0).Rows.Count - 1
If dsSystems.Table s(0).Rows(iSyst ems)(1).ToStrin g = "Canada" Then
For iChkBox = 0 To chkBoxCanada.It ems.Count - 1
If chkBoxCanada.It ems(iChkBox).Va lue =
dsSystems.Table s(0).Rows(iSyst ems)(0).ToStrin g Then
chkBoxCanada.It ems(iChkBox).Se lected = True

End If

Next

End If
Next

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

"Stephen" <st********@hot mail.com> wrote in message
news:uT******** ******@TK2MSFTN GP12.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
8068
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 status. David
4
6516
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 like dim li as ListItem li = new ListItem("title","value"); '' how to define here the CSS for List Item, not CheckBoxList?!?!?! myCheckBoxList.Items(x).add(li);
7
15627
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 want to have vertical scroll bar (like CheckedListBox in Window development) to save space. Can we do that in ASP.NET ? Please give me your suggestions ? Thanks in advance.
5
13386
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 to get a Boolean value TRUE or FALSE when a checkBox is selected. When the checkBoxList was out of the DataList i used "OnSelectedIndexChanged" and it was returning what i wanted but if its in a
4
4034
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 work:( Thanks My CheckBoxList in the DataList Below
0
2172
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 ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
0
2411
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 ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
2
3857
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 present and generated when the page is requested using IE. Confusing. Anything I can do? <%= Clinton Gallagher NET csgallagher AT metromilwaukee.com URL http://clintongallagher.metromilwaukee.com/
6
3498
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
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8856
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.