travisowens
Centurion
I am using the following code example I dug up to learn template based ASP.Net web apps but I don't see how I can add dynamic controls (iow creating a Table control and putting it into the page).
Here's the code for the header (testheader.ascx):
Here's the code for the footer (testfooter.ascx):
Now - here's the main page, where each user control is inserted:
Now when I try to do the following in my Page_Load event, no table appears in my page view in runtime, why not?
Here's the code for the header (testheader.ascx):
Code:
<div align="center">
<font Size="5"><b>Test Header</b></font>
</div>
Here's the code for the footer (testfooter.ascx):
Code:
<div align="center"><hr>
<font Size="2"><i>Test Footer</i><br> Copyright 2002, All Rights Reserved</font>
</div>
Code:
<%@ Register TagPrefix="xprs" tagname="footer" src="Testfooter.ascx" %>
<%@ Register TagPrefix="xprs" tagname="header" src="testheader.ascx" %>
<html>
<head>
<meta name="GENERATOR" Content="ASP Express 2.0">
<title>Heading of Page Goes here</title>
</head>
<body>
<xprs:header runat="server"/>
<i><font Color="#0000FF">As you can see - the Header is on the top of this page.
</font></i> <p>
Again - two lines accomplish this, also.</font></i>
<xprs:footer runat="server"/>
</body>
</html>
Now when I try to do the following in my Page_Load event, no table appears in my page view in runtime, why not?
Code:
Table menu = new Table();
TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.Text = "TestCell";
row.Cells.Add(cell);
menu.Rows.Add(row);
Page.Controls.Add(menu);
TextBox txtBox = new TextBox();
Page.Controls.Add(txtBox);