Dynamic controls not rendering - please help...

  • Thread starter Thread starter David Smith
  • Start date Start date
D

David Smith

I have the following snippet which will not render the control on the page:

foreach(DataRow dr in ds.Tables[0].Rows)

{

System.Web.UI.HtmlControls.HtmlTableRow r = new
System.Web.UI.HtmlControls.HtmlTableRow();

System.Web.UI.HtmlControls.HtmlTableCell c1 = new
System.Web.UI.HtmlControls.HtmlTableCell();

System.Web.UI.HtmlControls.HtmlTableCell c2 = new
System.Web.UI.HtmlControls.HtmlTableCell();

LinkButton newBrowseItem1 = new LinkButton();

newBrowseItem1.Text = "Test";

newBrowseItem1.ID = "Browse" + x.ToString();

c1.Controls.Add(newBrowseItem1);

LinkButton newBrowseItem2 = new LinkButton();

newBrowseItem2.Text = "Test";

newBrowseItem2.ID = "Browse" + x.ToString();

c2.Controls.Add(newBrowseItem2);

r.Cells.Add(c1);

r.Cells.Add(c2);

x++;

}
 
Back
Top