I am retrieving data from sqlserver using Dropdown list box selected value and storing it in an arraylist. Now the problem is how to retieve the arraylist values and display in the table.
Use it like below
ArrayList myArrayList = new ArrayList();
//Fill ArrayList values from the SQL Server
myArrayList.Add("Hello");
myArrayList.Add("World");
Table table = new Table();
foreach (var item in myArrayList)
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
//Add Arraylist item into TableCell to display it
tc.Text = item.ToString();
tr.Cells.Add(tc);
table.Rows.Add(tr);
}
If you are using asp.net mvc you can use something like this:
<table>
@foreach (var item in List) {
<tr>
<td>
item.somethingA
</td>
<td>
item.somethingB
</td>
</tr>
}
</table>
etc to create table
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.