:master: La soluzione è sempre quella: ad ogni postback bisogna generare sempre quello che si è generato a mano
quello di sotto è un piccolo esempio che funziona perfettamente
codice:
Option Strict On
Partial Class prova_a
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
VisualizzaTabella()
End Sub
Protected Sub VisualizzaTabella()
Dim table As New Table()
Dim tr As New TableRow()
Dim c As New TableCell()
Dim tb As New TextBox()
tb.ID = "TextBox1"
tb.AutoPostBack = True
AddHandler tb.TextChanged, AddressOf TextBox1_TextChanged
c.Controls.Add(tb)
tr.Cells.Add(c)
table.Rows.Add(tr)
Me.PlaceHolder1.Controls.Add(table)
End Sub
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim tb As TextBox = DirectCast(sender, TextBox)
PrintLn(tb.Text)
End Sub
End Class