Iterate through "System.Web.UI.HtmlControls.HtmlTable" to ge to the table cells

Posted on 2007-10-10
Last Modified: 2013-11-26
Good morning experts,
I need help. I have a Multiview Control.  In Each View, I have a table.  I need to be able to Iterate through all the table cells in order to set the values of controls I have in these cells
Currently, I find the Multiview Control by this....
Dim M As Control = MainContent.FindControl("MultiView1")  (where MultiView1 is the ID of the Multiview)
For Each ctlM In M.Controls
Doing this, I see the "System.Web.UI.HtmlControls.HtmlTable"
BUT...I do not see the row,cell or most important, the UserControl inside the cells.
I need to see an example of script that itereates through the table, row and cell in order for the controls within the cells to be exposed.

Desparation is setting in.  PLease help if you are able.

Question by:katzhoward
    LVL 18

    Accepted Solution


    Well Here is one example on how to collect some specific HtmlTable(sever control) data into a datatable or whatever you like to do with the data

            Dim dt As New DataTable
            Dim i As Integer
            Dim oHTMLtr As New HtmlTableRow
            Dim numrows As Integer = oMyHtmlTable.Rows.Count
            Dim dr As DataRow

            dt.Columns.Add(New DataColumn("col0", GetType(string)))
            dt.Columns.Add(New DataColumn("col1", GetType(string)))

            For Each oHTMLtr In oMyHtmlTable.Rows
                For i = 0 To numrows - 1

                    dr = dt.NewRow() ' created new row in the table


                Next i

    LVL 21

    Assisted Solution

    Instead may i suggest using a data grid and bind it to a data source like a list of objects. When you want to make a change you could update the datasource and your data grid would automatically start displaying the new values. I feel that would be simpler

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video discusses moving either the default database or any database to a new volume.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now