I have a html table on aspx page
<table width="600" border="0" cellspacing="0" cellpadding="0" id="table1" runat="server">
</table>
Now in the code behind i am trying to add rows & column to it dynamicaly but i get following error
Object reference not set to an instance of an object.
Code Behind
System.Web.UI.HtmlControls.HtmlTableRow row = new HtmlTableRow();
System.Web.UI.HtmlControls.HtmlTableRow row2 = new HtmlTableRow();
System.Web.UI.HtmlControls.HtmlTableCell col1 = new HtmlTableCell();
System.Web.UI.HtmlControls.HtmlTableCell col2 = new HtmlTableCell();
System.Web.UI.HtmlControls.HtmlTable tab = new HtmlTable();
tab = (HtmlTable)this.FindControl("table1");
col1.InnerHtml = "Test";
row.Cells.Add(col1);
col2.InnerHtml = "Test2";
row2.Cells.Add(col2);
...
Go to the complete details ...