Table Rows

T

Tim

Hello,

I have dynamically created a table in ASP.NET using tbl.rows.add(tr)
method where 'tbl' is a System.Web.UI.WebControls.Table. and tr is a
TableRows object.

Any ideas why I can't then itterate through the table object and reference
each of the rows using:

Dim tb as tablesRow
For Each tr In tbl.Rows
xx = tr.Cells(1).Text
Next

There appears to be no rows in the table ie. tbl.tablerows.count = 0

TIA

Tim
 
M

Mr Newbie

Dim t as new table

Page.Controls.Add(t)

Dim r As TableRow

Dim c As TableCell

For i As Int32 = 0 To 5

r = New TableRow

c = New TableCell

c.Text = i.ToString

r.Cells.Add(c)

t.Rows.Add(r)

Next

For Each r In t.Rows

Response.Write("<BR>Cell Value = " & r.Cells(0).Text)

Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top