Checking CheckBoxes in CheckBoxList

Posted on 2006-05-03
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

    The code you have should work fine. Are you getting any exceptions or anything ?

        ChkList_CoBrand1.Items[0].Selected = true;

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now