Hola a todos, tengo un problema al trabajar con el control Table del VS, resulta q tengo un boton con el cual agrego dinamicamente un montooon de controles dentro de mi table, bueno hasta ahi no hay problema porq se muestran bien, pero cuando quiero obtener los valores ingresados en los controles que ingrese dinamicamente no los puedo obtener, es mas, mi control table aparece vacio como si no hubiera agregado nada.
Pensando que podria ser propio del control lo he intentado con un panel y se me presenta el mismo problema, el panel pierde los controles q incialmente le adicione
Aqui una parte de un codigo q estoy usando de prueba
Esto me pasa con el Control Panel
Código:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim txt As New TextBox
txt.ID = "ww"
Panel1.Controls.Add(txt)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label1.Text = CType(Panel1.FindControl("ww"), TextBox).Text
End Sub
Y esto me pasa con mi control Table
Al igual q en el ejemplo anterior el recuperar la informacion ingresada no me es posible
Código:
Function carga_Tabla()
Dim txt As New TextBox
txt.ID = "11"
txt.Text = "11"
Zona1.Controls.Add(txt)
Dim rowCnt As Integer
Dim rowCtr As Integer
Dim cellCtr As Integer
Dim cellCnt As Integer
rowCnt = CInt(3)
cellCnt = CInt(3)
For rowCtr = 1 To rowCnt
Dim tRow As New TableRow
For cellCtr = 1 To cellCnt
Dim tCell As New TableCell
tCell.Text = "Row " & rowCtr & ", Cell " & cellCtr
Dim txt As New TextBox
txt .ID = "ww"
txt .Text = rowCtr & "" & cellCtr
tCell.Controls.Add(txt )
tRow.Cells.Add(tCell)
Next
Table3.Rows.Add(tRow)
Next
Table3.EnableViewState = True
End Function
Espero que alguno de ustedes pueda darme un alcance de como salir de este problema, de antemano gracias