Thursday, 15 May 2014

c# - Create X tables by looping with HtmlGenericControl -


I'm trying to create 10 separate tables, but I end up with only one.

  HtmlGenericControl table = new HtmlGenericControl ("table"); For (Int i = 1; I <5; i ++) {table.ID = "Serie_table_" + i; Table. a quality. Add ("Square", "Serie_Table"); DivSerie_lists.Controls.Add (table); }  

I want the following result:

   

But I end up with:

  & lt; Table id = "serie_table_4" class = "serie_table" />  

I hope you can help me though - and make tables correctly.

You change the same object 4 times instead you need to create 4 different objects:

 for  (int i = 1; i  

In addition to this, you can use HtmlGenericControl instead.


No comments:

Post a Comment