Checking CheckBoxes in CheckBoxList

Posted on 2006-05-03
Medium Priority
Last Modified: 2008-03-06
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>

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

Question by:Ashwin_shastry
1 Comment
LVL 52

Accepted Solution

Carl Tawn earned 1200 total points
ID: 16601116
The code you have should work fine. Are you getting any exceptions or anything ?

    ChkList_CoBrand1.Items[0].Selected = true;

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question