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. Listbox and Collection

Listbox and Collection

Scheduled Pinned Locked Moved ASP.NET
question
7 Posts 4 Posters 0 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.
  • L Offline
    L Offline
    Leandrao
    wrote on last edited by
    #1

    Hi group, I'm using a listbox and the datasource is a collection of the objects. My code is: lisbox.Datasource = collection it's ok. I'd like to get the object selected in listbox, but i'm not getting. How I do it? Sorry my bad English. Thanks,

    E 1 Reply Last reply
    0
    • L Leandrao

      Hi group, I'm using a listbox and the datasource is a collection of the objects. My code is: lisbox.Datasource = collection it's ok. I'd like to get the object selected in listbox, but i'm not getting. How I do it? Sorry my bad English. Thanks,

      E Offline
      E Offline
      eyeseetee
      wrote on last edited by
      #2

      listbox.selecteditem

      We are not a Code Charity

      L 1 Reply Last reply
      0
      • E eyeseetee

        listbox.selecteditem

        We are not a Code Charity

        L Offline
        L Offline
        Leandrao
        wrote on last edited by
        #3

        It dont work.

        R 1 Reply Last reply
        0
        • L Leandrao

          It dont work.

          R Offline
          R Offline
          r aa j
          wrote on last edited by
          #4

          send me ur code

          Rajendran.AL

          L 1 Reply Last reply
          0
          • R r aa j

            send me ur code

            Rajendran.AL

            L Offline
            L Offline
            Leandrao
            wrote on last edited by
            #5

            Go, Sub One() - called onLoad Dim colVOLEndereco As Collection colVOLEndereco = objBLLEndereco.fnListar If colVOLEndereco.Count > 0 Then lstEnderecos.DataSource = colVOLEndereco lstEnderecos.DataTextField = "pstrNome" lstEnderecos.DataValueField = "pstrIDEndereco" lstEnderecos.DataBind() end if End Sub Sub Two() - Called on postback Dim colVOLEndereco As Collection colVOLEndereco = lstEnderecos.SelectedItem End sub In sub two, the object selected isn't got. I'd like to put the selected object in colVOLEndereco. OK?

            T R 2 Replies Last reply
            0
            • L Leandrao

              Go, Sub One() - called onLoad Dim colVOLEndereco As Collection colVOLEndereco = objBLLEndereco.fnListar If colVOLEndereco.Count > 0 Then lstEnderecos.DataSource = colVOLEndereco lstEnderecos.DataTextField = "pstrNome" lstEnderecos.DataValueField = "pstrIDEndereco" lstEnderecos.DataBind() end if End Sub Sub Two() - Called on postback Dim colVOLEndereco As Collection colVOLEndereco = lstEnderecos.SelectedItem End sub In sub two, the object selected isn't got. I'd like to put the selected object in colVOLEndereco. OK?

              T Offline
              T Offline
              t7bros
              wrote on last edited by
              #6

              Is "Sub One()" called during every page load? You probably only want to call "Sub One()" only on the initial page load, or when the collection has changed.

              Have faith in yourself; amateurs built the Ark, professionals built the Titanic.

              1 Reply Last reply
              0
              • L Leandrao

                Go, Sub One() - called onLoad Dim colVOLEndereco As Collection colVOLEndereco = objBLLEndereco.fnListar If colVOLEndereco.Count > 0 Then lstEnderecos.DataSource = colVOLEndereco lstEnderecos.DataTextField = "pstrNome" lstEnderecos.DataValueField = "pstrIDEndereco" lstEnderecos.DataBind() end if End Sub Sub Two() - Called on postback Dim colVOLEndereco As Collection colVOLEndereco = lstEnderecos.SelectedItem End sub In sub two, the object selected isn't got. I'd like to put the selected object in colVOLEndereco. OK?

                R Offline
                R Offline
                r aa j
                wrote on last edited by
                #7

                call sub one() function in page_load

                Rajendran.AL

                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