postback for dynamically created table

M

martin

Hi,

I have the following code in my page load event that creates a table on the
web page.
The trouble is that after a postback such as a button click on the page the
table is not retained but ignored.

If Not IsPostBack() Then
Response.Write("This is NOT a postback<br>")
Dim tblMain As New Table
Dim tblRow As New TableRow
Dim tblCell As New TableCell

tblMain.Rows.Add(tblRow)
tblCell.Text = "hello"
tblMain.Rows(0).Cells.Add(tblCell)

Controls.Add(tblMain)
Else
Response.Write("This is a postback<br>")
End If


I would apprecaite advice on how to redisplay the table without actually
re-building it everytime the page re loads.

cheers

martin.
 
A

avnrao

any dynamically created controls should be created on every postback. the
best place to keep them is in Init method of the page.

Av.
 

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

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top