c# - Cannot retrieve value of dynamically created textboxes -


good day!

i'm creating dynamic textboxes. number of textboxes should created depends on number of column elements xml has. can create textboxes, problem retrieving value of each textboxes on button click. me this?

thanks!

here code fro creating textboxes:

        foreach (xmlclasses.column col in columns.tolist())         {             literal lt = new literal();             textbox txtbox = new textbox();             label lbl = new label();              lt.text = "<br/>";             lbl.text = col.title + ":";             lbl.width = unit.pixel(200);             txtbox.id = "txtbox_" + col.id;             txtbox.width = unit.pixel(200);              panel1.controls.add(lt);             panel1.controls.add(lbl);             panel1.controls.add(txtbox);         } 

here code retrieving:(button_click)

        foreach (xmlclasses.column col in columns.tolist())         {             textbox txt = new textbox();             panel pnl = new panel();             contentplaceholder cph = (contentplaceholder)master.findcontrol("contentplaceholder1");             if(cph != null)             {                 pnl = (panel)cph.findcontrol("panel1");                 if (pnl != null)                 {                     txt = (textbox)pnl.findcontrol("txtbox_" + col.id);                     if (txt != null)                     {                         value = txt.text;                     }                     else                     {                         value = "noooo";                     }                 }             }          } 

i getting value "noooo". missing something??


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -