asp.net - How to preserve dynamically created controls? -


i want preserve dynamically created control when postback occurs .

protected void page_load(object sender, eventargs e) {  }  private void createtable() {     htmltablerow objhtmltblrow = new htmltablerow();     htmltablecell objhtmltablecell = new htmltablecell();     objhtmltablecell.controls.add(new textbox());     objhtmltblrow.cells.add(objhtmltablecell);     mytable.rows.add(objhtmltblrow);     this.savecontrolstate();   //  this.controls.add(mytable); } protected void button1_click(object sender, eventargs e) {     createtable(); } 

it can achieved calling createtable() in page_load. there alternative way preserve control

thanks

you can add them list when create them , save list session. on postback (page_load) load them session page.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

sql server - python to mssql encoding problem -

windows - Python Service Installation - "Could not find PythonClass entry" -