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. Cannot get checkbox element in Datagrid using javascript in FF

Cannot get checkbox element in Datagrid using javascript in FF

Scheduled Pinned Locked Moved ASP.NET
javascript
3 Posts 2 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
    lahari_padigala
    wrote on last edited by
    #1

    I have a checkbox in a datagrid and when i check the items and press addbutton i need to add all the checked rows value into hidden field.the add button calls the function readData() on client side. the code was working fine with IE but it was not woking with mozilla function ReadData() { var grdContacts = document.getElementById('grdContacts'); var hiddenContacts = document.getElementById('hiddenContacts'); var rowCount = grdContacts.rows.length; if(rowCount > 1) { var count =1; for(; count < rowcount ; count++) { if(grdContacts.rows[count].cells[0].childNodes[0].childNodes[0].checked == true) { hiddenContacts.value += grdContacts.rows[count].cells[2].innerText + ";"; } } }

    C 1 Reply Last reply
    0
    • L lahari_padigala

      I have a checkbox in a datagrid and when i check the items and press addbutton i need to add all the checked rows value into hidden field.the add button calls the function readData() on client side. the code was working fine with IE but it was not woking with mozilla function ReadData() { var grdContacts = document.getElementById('grdContacts'); var hiddenContacts = document.getElementById('hiddenContacts'); var rowCount = grdContacts.rows.length; if(rowCount > 1) { var count =1; for(; count < rowcount ; count++) { if(grdContacts.rows[count].cells[0].childNodes[0].childNodes[0].checked == true) { hiddenContacts.value += grdContacts.rows[count].cells[2].innerText + ";"; } } }

      C Offline
      C Offline
      Chetan Patel
      wrote on last edited by
      #2

      You can try with innerHTML It should work in all the browser

      Best Regards, Chetan Patel

      L 1 Reply Last reply
      0
      • C Chetan Patel

        You can try with innerHTML It should work in all the browser

        Best Regards, Chetan Patel

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

        I need to first find my check box and if the check box is checked then i need to get the InnerText. I got the solution for the above. Modified the function as below. function ReadData() { var grdContacts = document.getElementById('grdContacts'); var hiddenContacts = document.getElementById('hiddenContacts'); var rowCount = grdContacts.rows.length; if(rowCount > 1) { var browserName=navigator.appName; for(var count =1; count

        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