By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,592 Members | 1,958 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,592 IT Pros & Developers. It's quick & easy.

postback for dynamically created table

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


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

Av.
"martin" <St**************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.