Hi,

I'm new in asp and c# and I've being looking everywhere on how to dynamically create multiple html tables based on a user input:

e.g.: user enter 3 in a text box and right below 3 tables are created with other text boxes for more user input.

Thanks

Just like you create any new object.
If you have a PlaceHolder on the page, create the new Table() and add it to the Controls of the PlaceHolder.

But there is any other way like adding a loop inside the html to create those tables instead of codebehind?

I thought about using Razor but I don't know how

Yes, but I would not do it that way.
It will be the same code, just in a different place.

...and another question, what's the difference in adding the table using Controls.Add and HtmlTable table1 = new HtmlTable() ?

If you're just talking about adding it directly to the PlaceHolder -- virtually nothing except with the latter will allow less syntax until you're ready to add it to the PlaceHolder.

thines01, thanks for your help....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.