Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. get items selected within 'checkboxlist'

get items selected within 'checkboxlist'

Scheduled Pinned Locked Moved ASP.NET
questioncsharphelptutorial
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gsshaw
    wrote on last edited by
    #1

    This may be a newbie question, but I am using System.Net.Mail to send an email, containing the data from a form. getting the text from the textboxes, and selected values from the drop-down boxes was easy. What I am struggling with now is how to get a list of which items, from within the 'checkboxlist' were selected when the 'submit' button was clicked. The most I have been able to get so far, using the .SelectedItem attribute is the FIRST value. I haven't figured out how to retrieve the collection that is a list of all the items that were selected. Make sense? any help or ideas would be appreciated. Thanks ,Gary

    S 1 Reply Last reply
    0
    • G gsshaw

      This may be a newbie question, but I am using System.Net.Mail to send an email, containing the data from a form. getting the text from the textboxes, and selected values from the drop-down boxes was easy. What I am struggling with now is how to get a list of which items, from within the 'checkboxlist' were selected when the 'submit' button was clicked. The most I have been able to get so far, using the .SelectedItem attribute is the FIRST value. I haven't figured out how to retrieve the collection that is a list of all the items that were selected. Make sense? any help or ideas would be appreciated. Thanks ,Gary

      S Offline
      S Offline
      SABhatti
      wrote on last edited by
      #2

      loop through the checkbox list and check if the item is selected then get its text. something like this: foreach(ListItem li in cblist.Items) { if(li.Selected) // do here whatever you need to do }

      -----

      G 1 Reply Last reply
      0
      • S SABhatti

        loop through the checkbox list and check if the item is selected then get its text. something like this: foreach(ListItem li in cblist.Items) { if(li.Selected) // do here whatever you need to do }

        -----

        G Offline
        G Offline
        gsshaw
        wrote on last edited by
        #3

        that did it.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups