Oct 20, 2010, 8:52 PM
[CLOSED] I can not obtain a ComboBox created dinamically in the code behind
I have created some ComboBoxes in the code behind, but when I try to obtain one of those controls, the function "X.GetCmp<ComboBox>("ComboBoxID")" gives me a ComboBox that is not the one I created (it doesn't have any value that i have created). In fact, when I use "X.GetCmp("ComboBoxID")", it returns me null.
Both functions work fine with the ComboBoxes created normally in the aspx.
This is mi code:
I create the ComboBox here:
Both functions work fine with the ComboBoxes created normally in the aspx.
This is mi code:
I create the ComboBox here:
ComboBox cmbNivelX = new ComboBox(cmbConfig);
cmbNivelX.ID = "cmbNivel" + intNivel;
cmbNivelX.AutoDataBind = true;
cmbNivelX.FieldLabel = "Nivel " + intNivel;
(...)
foreach (Jerarquia jerarquia in lstJerarquiasNivelX)
cmbNivelX.Items.Add(new Ext.Net.ListItem(jerarquia.Descripcion.Trim(), jerarquia.Id.Trim()));
Container ctnNivelX = new Container(ctnNivelConfig);
ctnNivelX.ID = "ctnNivel" + intNivel;
ctnNivelX.Add(cmbNivelX);
Container ctnFilaX = new Container(ctnFilaConfig);
ctnFilaX.ID = "ctnFila" + intFila;
ctnFilaX.Add(ctnNivelX);
//This panel was created in the aspx
pnlCombosNiveles.Add(ctnFilaX);
(...)
I try to obtain the ComboBox here:[DirectMethod]
protected void cmbNivel1_Seleccion(object sender, DirectEventArgs e)
{
try
{
(...)
//This returns me an empty ComboBox
ComboBox cmbNivelX = X.GetCmp<ComboBox>("cmbNivel" + intNivel.ToString());
//This returns me null
ComboBox cmbNivelX = X.GetCmp("cmbNivel" + intNivel.ToString());
(...)
Thank's a lot!
Last edited by Daniil; Oct 25, 2010 at 8:24 AM.
Reason: [CLOSED]