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
  1. Home
  2. Web Development
  3. ASP.NET
  4. insert the selected values from the checkboxlist into database

insert the selected values from the checkboxlist into database

Scheduled Pinned Locked Moved ASP.NET
questiondatabase
7 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.
  • R Offline
    R Offline
    rameshdontagani
    wrote on last edited by
    #1

    How do i insert the selected values from the checkboxlist into database and then retrieve them....here i am selecting the multiple items from the checkboxlist i can get the selected values but i cant insert them get insert string not in right format -- im passing 1,4,7 to the variable also how do i retrieve and get the selected values?

    P S 2 Replies Last reply
    0
    • R rameshdontagani

      How do i insert the selected values from the checkboxlist into database and then retrieve them....here i am selecting the multiple items from the checkboxlist i can get the selected values but i cant insert them get insert string not in right format -- im passing 1,4,7 to the variable also how do i retrieve and get the selected values?

      P Offline
      P Offline
      Piyush Vardhan Singh
      wrote on last edited by
      #2

      i think u want store text of selected value

      Piyush Vardhan Singh

      R 1 Reply Last reply
      0
      • P Piyush Vardhan Singh

        i think u want store text of selected value

        Piyush Vardhan Singh

        R Offline
        R Offline
        rameshdontagani
        wrote on last edited by
        #3

        selected ids, not text.....

        P 1 Reply Last reply
        0
        • R rameshdontagani

          How do i insert the selected values from the checkboxlist into database and then retrieve them....here i am selecting the multiple items from the checkboxlist i can get the selected values but i cant insert them get insert string not in right format -- im passing 1,4,7 to the variable also how do i retrieve and get the selected values?

          S Offline
          S Offline
          Sarani Ravindran
          wrote on last edited by
          #4

          Try this code.If it doesn't helps you send me your code. Dim str as string For i = 0 To checkboxlist1.Items.Count - 1 If checkboxlist1.Items(i).Selected = True Then str = checkboxlist1.Items(i).Value & "," & str End If Next Then,take the substring of str and pass it to the database. God is always with you.

          R 1 Reply Last reply
          0
          • R rameshdontagani

            selected ids, not text.....

            P Offline
            P Offline
            Piyush Vardhan Singh
            wrote on last edited by
            #5

            string str1 = CheckBoxList1.SelectedValue;

            Piyush Vardhan Singh

            1 Reply Last reply
            0
            • S Sarani Ravindran

              Try this code.If it doesn't helps you send me your code. Dim str as string For i = 0 To checkboxlist1.Items.Count - 1 If checkboxlist1.Items(i).Selected = True Then str = checkboxlist1.Items(i).Value & "," & str End If Next Then,take the substring of str and pass it to the database. God is always with you.

              R Offline
              R Offline
              rameshdontagani
              wrote on last edited by
              #6

              ya...this is working fine....but how can i retrieve those(text..not ids now) and place those in Datgarid

              S 1 Reply Last reply
              0
              • R rameshdontagani

                ya...this is working fine....but how can i retrieve those(text..not ids now) and place those in Datgarid

                S Offline
                S Offline
                Sarani Ravindran
                wrote on last edited by
                #7

                You have to get the total number of rows from the table.Use Dataset. For example, For i = 0 To sqlDataset.Tables(0).Rows.Count - 1 //Your Code. Next Then get the checkbox items that are checked. God is always with you.

                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