ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.How create dynamic html table from the datatable with rowspan and colspan in ASP.Net<p>Add a Panel on the page</p> <pre class="brush: xml"> &lt;asp:Panel ID=&#34;Panel1&#34; runat=&#34;server&#34;&gt; &lt;/asp:Panel&gt; </pre> <p>and then create and add the table to panel</p> <pre class="brush: csharp">Table table = new Table(); table.BorderStyle = BorderStyle.Solid; //Add Header Row TableRow row = new TableRow(); TableHeaderCell headerCell = new TableHeaderCell(); headerCell.Text = &#34;Item&#34;; row.BackColor = Color.Green; row.Controls.Add(headerCell); headerCell = new TableHeaderCell(); headerCell.Text = &#34;Price&#34;; row.Controls.Add(headerCell); table.Controls.Add(row); //Add DataRow row = new TableRow(); TableCell cell = new TableCell(); cell.Text = &#34;Shirt&#34;; row.Controls.Add(cell); cell = new TableCell(); cell.Text = &#34;200&#34;; row.Controls.Add(cell); row.BackColor = Color.Yellow; table.Controls.Add(row); //Add Colspan Row row = new TableRow(); row.BorderStyle = BorderStyle.Solid; cell = new TableCell(); cell.Text = &#34;Colspan Row&#34;; cell.ColumnSpan = 2; row.Controls.Add(cell); row.BackColor = Color.Brown; table.Controls.Add(row); //Add DataRow row = new TableRow(); cell = new TableCell(); cell.Text = &#34;Tie&#34;; row.Controls.Add(cell); cell = new TableCell(); cell.Text = &#34;30&#34;; row.Controls.Add(cell); table.Controls.Add(row); row.BackColor = Color.Beige; Panel1.Controls.Add(table); </pre> <p>&nbsp;</p> <div id="Panel1"> <table style="border-style: Solid;" border="0"> <tbody> <tr style="background-color: green;"><th>Item</th><th>Price</th></tr> <tr style="background-color: yellow;"> <td>Shirt</td> <td>200</td> </tr> <tr style="background-color: brown; border-style: Solid;"> <td colspan="2">Colspan Row</td> </tr> <tr style="background-color: beige;"> <td>Tie</td> <td>30</td> </tr> </tbody> </table> </div>https://www.aspforums.net:443/Threads/724519/How-create-dynamic-html-table-from-the-datatable-with-rowspan-and-colspan-in-ASPNet/https://www.aspforums.net:443/Threads/724519/How-create-dynamic-html-table-from-the-datatable-with-rowspan-and-colspan-in-ASPNet/Thu, 12 Jul 2012 23:40:27 GMT