[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2007-10-10
2
Medium Priority
?
391 Views
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
...
Next
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.
Thanks
Howard


 
0
Comment
Question by:Howard Katz
2 Comments
 
LVL 18

Accepted Solution

by:
vbturbo earned 1000 total points
ID: 20049945
Hi

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

                dr(i)=(oHTMLtr.Cells(0).InnerText)
                dr(i)=(oHTMLtr.Cells(1).InnerText)


            Next i
            dt.Rows.Add(dr)
        Next

vbturbo
0
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 1000 total points
ID: 20049946
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

834 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