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 loop through table?

how to loop through table?

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nettutorial
7 Posts 4 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.
  • H Offline
    H Offline
    hounetdev
    wrote on last edited by
    #1

    How do i loop through a table. I am using asp.net with (VB). i know how to create the loop just not how to call the table and its rows and cells what is the syntax for that? Thank you, Santana

    U P 2 Replies Last reply
    0
    • H hounetdev

      How do i loop through a table. I am using asp.net with (VB). i know how to create the loop just not how to call the table and its rows and cells what is the syntax for that? Thank you, Santana

      U Offline
      U Offline
      User 1124279
      wrote on last edited by
      #2

      Hi, You could do this using foreach loop as DataTable has a collection of DataRows. To do this... foreach (DataRow dr in DataSet1.Tables["myTable"].Rows) { //To access the values in each row use 'dr' as this is the DataRow in //subject to each loop. } Hope that helps. ~~~~~~~~~~~~~~~~~~~~~~~~ Shravan Addaypally .NET Apps Developer BellSouth Billing Inc. Birmingham, AL 35205 ~~~~~~~~~~~~~~~~~~~~~~~~

      H 1 Reply Last reply
      0
      • U User 1124279

        Hi, You could do this using foreach loop as DataTable has a collection of DataRows. To do this... foreach (DataRow dr in DataSet1.Tables["myTable"].Rows) { //To access the values in each row use 'dr' as this is the DataRow in //subject to each loop. } Hope that helps. ~~~~~~~~~~~~~~~~~~~~~~~~ Shravan Addaypally .NET Apps Developer BellSouth Billing Inc. Birmingham, AL 35205 ~~~~~~~~~~~~~~~~~~~~~~~~

        H Offline
        H Offline
        hounetdev
        wrote on last edited by
        #3

        Shravan, First thanks for the help. but i am trying to loop through a html table not t dataset or datatable. I created a html table and i want to loop through the cells. Another thing i am using asp.net with (VB). Thank you, Santana

        1 Reply Last reply
        0
        • H hounetdev

          How do i loop through a table. I am using asp.net with (VB). i know how to create the loop just not how to call the table and its rows and cells what is the syntax for that? Thank you, Santana

          P Offline
          P Offline
          PSK_
          wrote on last edited by
          #4

          Make the table as a server control and ... use the Innerhtml and innertext properties for ur use ... Regards, Prakash Kalakoti

          H 1 Reply Last reply
          0
          • P PSK_

            Make the table as a server control and ... use the Innerhtml and innertext properties for ur use ... Regards, Prakash Kalakoti

            H Offline
            H Offline
            hounetdev
            wrote on last edited by
            #5

            do you happen to have an example? I just need to know the right format/syntax. thank you Santana

            A 1 Reply Last reply
            0
            • H hounetdev

              do you happen to have an example? I just need to know the right format/syntax. thank you Santana

              A Offline
              A Offline
              alitboy
              wrote on last edited by
              #6

              Create a server side table like this Now you should be able to access any cell/Row using the index Table1.Rows(0) Table1.Rows(0).Cells(1)

              H 1 Reply Last reply
              0
              • A alitboy

                Create a server side table like this Now you should be able to access any cell/Row using the index Table1.Rows(0) Table1.Rows(0).Cells(1)

                H Offline
                H Offline
                hounetdev
                wrote on last edited by
                #7

                Thanks that worked. Santana

                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