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. asp table with javascript getelementbyid

asp table with javascript getelementbyid

Scheduled Pinned Locked Moved ASP.NET
javascripthtmlcsshelptutorial
4 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.
  • A Offline
    A Offline
    Aljaz111
    wrote on last edited by
    #1

    I have little problem. I am trying to get id of cell and put value in this cell with this js function: function fill_table(grid){ var str=grid.toString(); str=str.replace(/\n/g," "); var ar_grid=str.split(" "); var c=0; for(var i = 0; i < 81; i++) { c=i+1; ar_grid[i]=ar_grid[i].replace(/0/gi,""); document.getElementById('cell_'+c).value=ar_grid[i]; } } This works fine with html table but how to do this with asp table. I addded ID to each cell like this: TableCell c=new TableCell(); c.Attributes["ID"]= "cell_" + st;

    S A 2 Replies Last reply
    0
    • A Aljaz111

      I have little problem. I am trying to get id of cell and put value in this cell with this js function: function fill_table(grid){ var str=grid.toString(); str=str.replace(/\n/g," "); var ar_grid=str.split(" "); var c=0; for(var i = 0; i < 81; i++) { c=i+1; ar_grid[i]=ar_grid[i].replace(/0/gi,""); document.getElementById('cell_'+c).value=ar_grid[i]; } } This works fine with html table but how to do this with asp table. I addded ID to each cell like this: TableCell c=new TableCell(); c.Attributes["ID"]= "cell_" + st;

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      Aljaz111 wrote:

      c.Attributes["ID"]= "cell_" + st;

      Why doing this? Why not... c.ID = "cell_" + st;

      1 Reply Last reply
      0
      • A Aljaz111

        I have little problem. I am trying to get id of cell and put value in this cell with this js function: function fill_table(grid){ var str=grid.toString(); str=str.replace(/\n/g," "); var ar_grid=str.split(" "); var c=0; for(var i = 0; i < 81; i++) { c=i+1; ar_grid[i]=ar_grid[i].replace(/0/gi,""); document.getElementById('cell_'+c).value=ar_grid[i]; } } This works fine with html table but how to do this with asp table. I addded ID to each cell like this: TableCell c=new TableCell(); c.Attributes["ID"]= "cell_" + st;

        A Offline
        A Offline
        Amit M patel
        wrote on last edited by
        #3

        for set ID by asp table, you use as below TableCell c=new TableCell(); c.ID = "cell_" + st; Thanks, Amit

        With Regards, Amit Patel 91-9328488961 India

        A 1 Reply Last reply
        0
        • A Amit M patel

          for set ID by asp table, you use as below TableCell c=new TableCell(); c.ID = "cell_" + st; Thanks, Amit

          With Regards, Amit Patel 91-9328488961 India

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

          stil with adding ID to cell like this doesn't work. Does asp:table need to postback to get filled with values from javascript?

          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