Avatar of Ashwin_shastry
Ashwin_shastry

asked on 

Checking CheckBoxes in CheckBoxList

Hello guys,

I have a Check Box list like the follwoing

<asp:CheckBoxList id="ChkList_CoBrand1" runat="server" Width="117px" RepeatDirection="Vertical">
<asp:ListItem Value="Community Info">Community Info</asp:ListItem>
<asp:ListItem Value="Crime">Crime</asp:ListItem>
<asp:ListItem Value="Sal Analyser">Sal Analyser</asp:ListItem>
</asp:CheckBoxList>

My task is pretty simple on page load I retrieve from the database for each corresponding Listitem a bool value depending on the bool value returned (In this example say I will return true,true,false)I will need to check the items on which are true and not check items which are false .

How would i go about doing this???

I tried to use  ChkList_CoBrand1.Items[0].Selected = "true/false"
but that doesnot work..

How would i check/uncheck the Listitems in a CheckBoxList ?

Hoping for some help

Ashwin
C#

Avatar of undefined
Last Comment
Carl Tawn
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo