Buenas!
Tengo un Dropdownlist creado dinamicamente donde tengo un listado i me gustaria que al seleccionar un item debajo de este me saliera otro dropdownlist igual con el mismo listado?? tengo echo esto pero solo me muestra 1
Código:
TableRow fila = new TableRow();
TableCell celda = new TableCell();
DropDownList ddl_reparaciones = new DropDownList();
protected void Page_Load(object sender, EventArgs e)
{
recambios();
}
protected void recambios()
{
fila = new TableRow();
fila.Height = 25;
fila.BackColor = System.Drawing.Color.FromArgb(51, 0, 204);
fila.ForeColor = System.Drawing.Color.White;
celda = new TableCell();
celda.Height = 25;
celda.Width = 70;
celda.HorizontalAlign = HorizontalAlign.Left;
celda.BackColor = System.Drawing.Color.FromArgb(224, 224, 224);
ArrayList lista = CKeito.GetAllRecambios();
ddl_reparaciones = new DropDownList();
//ddl_reparaciones.AutoPostBack = true;
ddl_reparaciones.ToolTip = "Recambios";
ListItem item = new ListItem();
item.Value = "";
item.Text = "";
ddl_reparaciones.Items.Add(item);
foreach (CRecambio cc in lista)
{
item = new ListItem();
item.Text = cc.Recambio;
item.Value=cc.Recambio;
ddl_reparaciones.Items.Add(item);
}
//ddl_reparaciones.SelectedIndexChanged+=new EventHandler(ddl_reparaciones_SelectedIndexChanged);
celda.Controls.Add(ddl_reparaciones);
fila.Cells.Add(celda);
tbla_recambios.Rows.Add(fila);
}
protected void ddl_reparaciones_SelectedIndexChanged(object sender, EventArgs e)
{
recambios();
}