postback for dynamically created table

  • Thread starter Thread starter martin
  • Start date Start date
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.
 
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

Back
Top