bueno despues de estar horas tratando de hacerlo por fin encontre la solucion
primero los defini como un array de textbox de forma global
Código:
public Label[] IdCat = new Label [7];// = new Label();
public TextBox[] textBoxFra = new TextBox[7];
public TextBox[] textBoxTil = new TextBox[7];
luego desde un array tengo el listado donde deberian mostrarse los textbox
este servira para hacer un filtro de busqueda tipo desde-hasta por lo tanto deberia obtener el "id de categoria" - "int desde" - "int hasta", genero un for y los voy guardando
Código:
string[] ExcluList = { "Prisantydning", "Soverom", "Boareal (kvm)", "Husleie", "Km stand", "Lengde (fot)", "Årsmodell" };//, "Båttype", "Eieform", "Ferietype", "Hovedkategori", "Jobbkategori", "Kategori", "Kommune", "Land", "MC Type", "Modell", "Scooter/Moped", "Sted", "Stillingsnivå", "Type lokaler", "Underkategori" };
for (int er = 0; er < ExcluList.Length; er++)
{
if (filterCategory.Text == ExcluList[er])
{
Button searchPris = new Button();
searchPris.ID = "searchPris_"+er;
searchPris.Text = "Søk";
searchPris.Click += new System.EventHandler(searchPris_Click);
IdCat[er] = new Label();
IdCat[er].ID = "IdCat_" + er;
IdCat[er].Text = filterCategory.Id.ToString();
textBoxFra[er] = new TextBox();
textBoxFra[er].Width = 50;
textBoxFra[er].ID = filterCategory.Text;
//textBoxFra[er].TextChanged += new EventHandler(searchPris_Click);
textBoxTil[er] = new TextBox();
textBoxTil[er].Width = 50;
textBoxTil[er].ID = "textBoxTil_" + er;
//textBoxTil[er].TextChanged += new EventHandler(searchPris_Click);
tc.Controls.Add(textBoxFra[er]);
tc.Controls.Add(labelI);
tc.Controls.Add(textBoxTil[er]);
tc.Controls.Add(searchPris);
//labelI.Text += filterCategory.Id.ToString() + "-"+textBoxFra[er].ID.ToString() + "-" + textBoxTil[er].ID.ToString();
}
}
y al finalizar en el evento onClick los recibo
Código:
for (int er = 0; er < textBoxFra.Length; er++ )
{
if (textBoxFra[er] != null)
if (textBoxFra[er].Text != "")
{
PrisFra += textBoxFra[er].Text;
wil += er;
ExcluMe = textBoxFra[er].ID.ToString();
}
}
for (int er = 0; er < textBoxTil.Length; er++)
{
if (textBoxFra[er] != null)
if (textBoxTil[er].Text != "")
{
PrisTil += textBoxTil[er].Text;
//wil = er;
}
}
for (int er = 0; er < IdCat.Length; er++)
{
if (er == wil)
{
IdCata = IdCat[er].Text;
}
}
en unas semanas podras ver el resultado en
www.rubrikk.no.
saludos. Gracias por tu respuesta.