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. how to add 3 checkbox per row in htmltable dynamically

how to add 3 checkbox per row in htmltable dynamically

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

    Hi In my one of the application i am creating check box dynamically. for that purpose i am using html web server control. i am dynamically creating checkbox and it to table row and cell but i need only 3 checkbox per row when 4 checkbox added to the page it should come to next row how i can do this.My code is as follow.Please help me to solve this. While dr.Read Dim chkbox As CheckBox = New CheckBox chkbox.Text = dr(0) chkbox.CssClass = "pagetext2inside" chkbox.ID = "chklang" & i Dim tabcell As TableCell = New TableCell Dim tabrow As TableRow = New TableRow tabcell.Controls.Add(chkbox) tabrow.Controls.Add(tabcell) chktable.Rows.Add(tabrow) i = i + 1 End While dr.Close()

    Rahul

    S 1 Reply Last reply
    0
    • R rahul net11

      Hi In my one of the application i am creating check box dynamically. for that purpose i am using html web server control. i am dynamically creating checkbox and it to table row and cell but i need only 3 checkbox per row when 4 checkbox added to the page it should come to next row how i can do this.My code is as follow.Please help me to solve this. While dr.Read Dim chkbox As CheckBox = New CheckBox chkbox.Text = dr(0) chkbox.CssClass = "pagetext2inside" chkbox.ID = "chklang" & i Dim tabcell As TableCell = New TableCell Dim tabrow As TableRow = New TableRow tabcell.Controls.Add(chkbox) tabrow.Controls.Add(tabcell) chktable.Rows.Add(tabrow) i = i + 1 End While dr.Close()

      Rahul

      S Offline
      S Offline
      S Ullas
      wrote on last edited by
      #2

      Hi Rahul, I am not good in vb I think you can write the same as Dim tabrow As TableRow i = 0 While dr.Read Dim chkbox As CheckBox = New CheckBox chkbox.Text = dr(0) chkbox.CssClass = "pagetext2inside" chkbox.ID = "chklang" & i Dim tabcell As TableCell = New TableCell if (i mod 3)= 0 then if tabrow.Cells.Count > 0 then chktable.Rows.Add(tabrow) end if tabrow = New TableRow end if tabcell.Controls.Add(chkbox) tabrow.Controls.Add(tabcell) i = i + 1 End While dr.Close() if tabrow.Cells.Count > 0 then chktable.Rows.Add(tabrow) end if

      Ullas Sadanandan

      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