Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/06/2011, 15:41
Avatar de Miztli
Miztli
 
Fecha de Ingreso: abril-2007
Mensajes: 39
Antigüedad: 17 años
Puntos: 1
Respuesta: Agregando controles programaticamente

Tengo un archivo tabla.ascx con el siguiente código:

Código:
<asp:Table ID="Tabla" runat="server" BorderWidth="1px" Height="140px" Width="1085px">
</asp:TableRow>

<asp:Button ID="Button1" runat="server" Text="Button" 
    onclick="Button1_Click" />
Y tengo este otro archivo filas.ascx.cs

Código:
        protected void Button1_Click(object sender, EventArgs e)
        {
            TableRow fila = new TableRow();
            Tabla.Rows.Add(fila);

            TableCell columna = new TableCell();
            fila.Cells.Add(columna);
              
            TextBox nombre = new TextBox();
            columna.Controls.Add(nombre);
        }
Gracias por su ayuda e interé!