Results 1 to 3 of 3

Thread: CheckBoxList select

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2010
    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
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: CheckBoxList select

    have a look at the checkedlistbox.setitemchecked method:

    http://msdn.microsoft.com/en-us/libr...emchecked.aspx

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: CheckBoxList select

    Moved to the ASP.Net forum.

Posting Permissions

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



Click Here to Expand Forum to Full Width