I want to display N numbers of table in ASP.NET webform based on user input.
For example,
user input -> PDO123045,PDO122111
In this case, user input two values seperated by commas, so if I split the comma, I get length = 2. which are (PDO123045,PDO122111) in a list.
So I want to display two tables in asp webform.
2nd example,
user input -> PDO123045,PDO122111,PDO111345
In this case, user input two values seperated by commas, so if I split the comma, I get length = 3. which are (PDO123045,PDO122111,PDO111345) in a list.
So I want to display three tables in ASP.NET webform since user input three values.
I want to display N numbers of table in ASP.NET webform based on user input.
2
Answers
Ok, so you can do it this way:
I don’t have your data, but let’s say we are to type in 1 city, or several.
And for each city we type in (separated by a comma), then we are to display a table for each city.
So, our markup can be this:
And our code behind can be this:
And the result is this:
And I used a helper routine (one gets VERY tired very fast typing over and over connection string code).
Hence, MyRstP simple returns a data table.
You can use
StringBuilder
to compose it as HTML table and fill it into aplaceholder
.So first, you gonna add a
placeholder
into your front end:Then at your code behind: