asp.net - adding rows to a table dynamically with asp controls -


this worked me 5 minutes , have nothing. object select number dropdown list , use number assign how many rows added table.

using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.htmlcontrols;  public partial class _default : system.web.ui.page     {         protected void page_load(object sender, eventargs e)             {             }          protected void button1_click(object sender, eventargs e)             {                 //variables number of rows , cells                 int numrows = int.parse(dropdownlist1.selectedvalue);                 int numcells = 3;                 (int j = 0; j < numrows; j++)                     {                         htmltablerow r = new htmltablerow();                         r.bgcolor = "gainsboro";                         //demotable.rows.add(r);                          (int = 0; < numcells; i++)                             {                                 htmltablecell c = new htmltablecell();                                 c.innerhtml = " row " + j.tostring() + ", cell " + i.tostring();                                 r.cells.add(c);                                 }                         demotable.rows.add(r);                     }             }     } 


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -