Results 1 to 3 of 3

Thread: CheckBoxList select

  1. #1
    Junior Member
    Join Date
    Jun 10
    Posts
    26

    CheckBoxList select

    Please can someone tell me how to add an item to a CheckBoxList and then select it?

    Code:
                    <div class="seasonType">
                        Analysis Type<br />
                        <asp:CheckBoxList ID="cblAnalType" runat="server">
                        </asp:CheckBoxList>
                    </div>

    Code:
                DS = recall.getDistinctType()
    
                dt = DS.Tables(0)
    
                For Each dr In dt.Rows
                    cblAnalType.Items.Add(dr("RG_TYPE_VALUE").ToString)
                    If CBool(dr("RG_TYPE_SET")) Then
                        cblAnalType.SelectedValue = dr("RG_TYPE_VALUE").ToString
                    End If
                Next
    I have written this code but the RG_TYPE_SET is a boolean, so if it is true I want the tick boc to be selected.

    When I run this it only ever selects the last item in the list! Can more than one item be selected?

    thanks Paul

  2. #2

  3. #3
    Super Moderator Joacim Andersson's Avatar
    Join Date
    Jan 99
    Location
    Sweden
    Posts
    13,533

    Re: CheckBoxList select

    Moved to the ASP.Net forum.
    Joacim Andersson
    If anyone's answer has helped you, please show your appreciation by rating that answer.
    I'd rather run ScriptBrix...
    Joacim's view on stuff.

    MVP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •