score:1

Accepted answer

Define Label text before the while loop like this

lbl_table.Text = @"<table class='table table-bordered'>
                               <thead>
                               <tr>
                               <th>Product Name</th>
                               <th>Product Type</th>
                               <th>Image</th>
                               </tr>
                               </thead>
                               <tbody>";

Now inside the while loop you need to create only new row for each record like this

While()
{
      ...
      lbl_table.Text += @"<tr>
      <td>"+product_name+@"</td>
      <td>"+product_type+@"</td>
      <td>"+image_desc+@"</td>
      </tr>";
}

After completing while loop add tags for closing Table

lbl_table.Text += @"</tbody></table>";

Thats it.


More questions

More questions with similar tag