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. problem on checkboxlist

problem on checkboxlist

Scheduled Pinned Locked Moved ASP.NET
databasecsharphelp
5 Posts 3 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.
  • B Offline
    B Offline
    biswa47
    wrote on last edited by
    #1

    hello frndz. thanks for ur reply n solution to my query. here another small query for you. i have a checkboxlistitem.where let say A,B,C,D,E are the items in that control. i am able to store the mulitiple value of the checkbxlist item .(by taking a string and storing the multiple value by "," operator). now my problem is that when i am retriving the value from the db ,am not able to retrive the value of the lsitboxitems. (suppose in emp_id "1" i have stored the values of A,C,D from checkboxlist,when i retrive the record having emp id1. i want to retrive its value i.e A,C,D and the corresponding checkbox of the values to be checked in the front end.) what will be code in vb.net

    P 1 Reply Last reply
    0
    • B biswa47

      hello frndz. thanks for ur reply n solution to my query. here another small query for you. i have a checkboxlistitem.where let say A,B,C,D,E are the items in that control. i am able to store the mulitiple value of the checkbxlist item .(by taking a string and storing the multiple value by "," operator). now my problem is that when i am retriving the value from the db ,am not able to retrive the value of the lsitboxitems. (suppose in emp_id "1" i have stored the values of A,C,D from checkboxlist,when i retrive the record having emp id1. i want to retrive its value i.e A,C,D and the corresponding checkbox of the values to be checked in the front end.) what will be code in vb.net

      P Offline
      P Offline
      Panchal Hardik
      wrote on last edited by
      #2

      first u can splite the result row with 'A,C,D' with ",". now u have the array of the all checkbox which need to select. now with checkboxlist you can find the ur checkbox by text or value and give the property selected

      Hardik Panchal

      B 1 Reply Last reply
      0
      • P Panchal Hardik

        first u can splite the result row with 'A,C,D' with ",". now u have the array of the all checkbox which need to select. now with checkboxlist you can find the ur checkbox by text or value and give the property selected

        Hardik Panchal

        B Offline
        B Offline
        biswa47
        wrote on last edited by
        #3

        can u write the code for it. actully i have tried this logic but may be with wrong code. so asking you to write the code for it in vb.net

        P J 2 Replies Last reply
        0
        • B biswa47

          can u write the code for it. actully i have tried this logic but may be with wrong code. so asking you to write the code for it in vb.net

          P Offline
          P Offline
          Panchal Hardik
          wrote on last edited by
          #4

          For Each dr As DataRow In checkboxlist.Items if dr(columnname) = 'A' then checkboxlist.Items.checked = true end if Next

          Hardik Panchal

          1 Reply Last reply
          0
          • B biswa47

            can u write the code for it. actully i have tried this logic but may be with wrong code. so asking you to write the code for it in vb.net

            J Offline
            J Offline
            John ph
            wrote on last edited by
            #5

            Here is the code you asked for...

                        Dim lstItem As New ListItem
                        Dim lstItems() As String = Value.Split(",")  'Value = "A,B,C"
            
                        For Each lstItem In chklstItem.Items
                            For I As Int16 = 0 To lstItems.Length - 1
                                If lstItems(I) = lstItem.Value Then
                                    lstItem.Selected = True
                                End If
                            Next
                        Next
            

            I suggest you to write a property procedure which will GET and SET the values of the CheckBoxList...


            Regards
            John


            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