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. Inserting new values to checkboxlist in Jaavascript

Inserting new values to checkboxlist in Jaavascript

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nethelp
6 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.
  • M Offline
    M Offline
    Mahdi Jabbari
    wrote on last edited by
    #1

    How can I add new values to checkboxlist control of ASP.NET? I have done this by dropdown and listbox controls before but it's several days that I can't do this task. Please help me everyone.

    A B 2 Replies Last reply
    0
    • M Mahdi Jabbari

      How can I add new values to checkboxlist control of ASP.NET? I have done this by dropdown and listbox controls before but it's several days that I can't do this task. Please help me everyone.

      A Offline
      A Offline
      Anbuselvan
      wrote on last edited by
      #2

      Hi, Check this link... http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.checkboxlist(vs.80).aspx[^]

      P.Anbuselvan IT Consultant Emirates Group IT, UAE

      M 1 Reply Last reply
      0
      • A Anbuselvan

        Hi, Check this link... http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.checkboxlist(vs.80).aspx[^]

        P.Anbuselvan IT Consultant Emirates Group IT, UAE

        M Offline
        M Offline
        Mahdi Jabbari
        wrote on last edited by
        #3

        Hi sir!! I said in JAVASCRIPT.

        A 1 Reply Last reply
        0
        • M Mahdi Jabbari

          Hi sir!! I said in JAVASCRIPT.

          A Offline
          A Offline
          Anbuselvan
          wrote on last edited by
          #4

          You are right! :) Here is a JavaScript sample. Markup Part: ========= function AddMoreItems() { var newNode = null; var objList = document.getElementById('CheckBoxList1'); if (objList != null) { var tblBody = objList.getElementsByTagName('TBODY'); newNode = tblBody[0].rows[tblBody[0].rows.length-1].cloneNode(true); if (newNode != null) tblBody[0].appendChild(newNode); } return false; }

          Code Behind Part: ============= protected void Page_Load(object sender, EventArgs e) { CheckBoxList1.Items.Add(new ListItem("Hello")); CheckBoxList1.Items.Add(new ListItem("Welcome")); submitBtn.Attributes.Add("onclick", "return AddMoreItems();"); } I hope you got some idea! Enjoy! P.Anbuselvan IT Consultant Emirates Group IT, UAE

          1 Reply Last reply
          0
          • M Mahdi Jabbari

            How can I add new values to checkboxlist control of ASP.NET? I have done this by dropdown and listbox controls before but it's several days that I can't do this task. Please help me everyone.

            B Offline
            B Offline
            Blumen
            wrote on last edited by
            #5

            Hi, You can add ListItem to CheckBoxList in Javascript: Item 1 Item 2 Item 3 Item 4 Item 5 Item 6 Regards, Blumen

            B 1 Reply Last reply
            0
            • B Blumen

              Hi, You can add ListItem to CheckBoxList in Javascript: Item 1 Item 2 Item 3 Item 4 Item 5 Item 6 Regards, Blumen

              B Offline
              B Offline
              Blumen
              wrote on last edited by
              #6

              Hi, sorry, the script was stripped off from my message. Pls refer this MSDN article: http://msdn2.microsoft.com/en-us/library/8bw4x4wa(vs.71).aspx[^] blumen

              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