Create HTML design or table on run time in asp.net

Ranjeet_8
Posted by Ranjeet_8 under ASP.NET category on | Points: 40 | Views : 4952
Add below Div on ur ASPX design page.
 
<div id="HtmlDesign" runat="server" >
</div>

Add below code on ur page load event in C#.
 
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<table border='1'>");
sb.Append("<tr><td>Sno.</td><td>ECode</td><td>Name</td></tr>");
sb.Append("<tr><td>1</td><td>001</td><td>Aashi</td></tr>");
sb.Append("<tr><td>2</td><td>002</td><td>Ranjan</td></tr>");
sb.Append("<tr><td>3</td><td>003</td><td>Arun</td></tr>");
sb.Append("</table>");
HtmlDesign.InnerHtml = sb.ToString();

Comments or Responses

Login to post response