Remember dyanmically built HTMLTables on post back

I have two tables which I dynamically create when the page loads. I want to be able to add rows to those tables, but when I do the simple code of adding another row, after the second load the page completely forgets about what the tables looked like on the first load.

Basically, how do I get the page to remember what the page looks like after each post back.

Here is some of my code:
    Private Sub BindSimilarItems()
        Dim row As New TableRow
        Dim itemRow As DataRow

        For Each itemRow In tblSimilarItems.Rows
            Dim cell As New TableCell
            Dim fp As FeaturedProduct = New FeaturedProduct( _
                itemRow.Item("itemNo"), _
                itemRow.Item("picType"), _
                itemRow.Item("picWidth"), _
                itemRow.Item("picHeight"), _
    End Sub
    Private Sub btnSeletMore_Click(ByVal obj As Object, ByVal e As EventArgs) Handles btnSeletMore.Click
        Dim newStyleRow As New TableRow
        Dim newCell As New TableCell
        newCell.Controls.Add(New LiteralControl("HI"))
    End Sub
Who is Participating?
raterusConnect With a Mentor Commented:
Not happening, controls do not persist across postbacks.  I would suggest looking into using a DataList, or a Repeater, and defining the ItemTemplate.  These will persist.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.