R
Richard Lionheart
Hi,
I've got simple C#/WebForms VS.NET app that ostensibly populates a table
server-side, but no table is displayed client side. I tried a couple of
other dynamically generated pages with no luck there either. The code is
provided below. Any ideas?
--
Regards,
Richard
======== AddingRows.aspx =============
<%@ Page language="c#" Codebehind="AddingRows.aspx.cs"
AutoEventWireup="false" Inherits="TestAddingRowsToTable.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<!-- meta statements deleted -->
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Label id="Label1" runat="server" Width="205px">Testing Dynamicly
Adding Rows</asp:Label>
<HR width="100%" SIZE="1">
<asp:Table id="MyTable" runat="server" Width="122px"></asp:Table>
</form>
</body>
</HTML>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e)
{
for (int i=1; i<=2; i++)
{
TableRow r = new TableRow();
for (int j=1; j<=2; j++)
{
TableCell c = new TableCell();
c.Text = String.Format("Row {0}, Col (1}", i, j);
r.Cells.Add(c);
}
MyTable.Rows.Add(r);
}
}
</script>
I've got simple C#/WebForms VS.NET app that ostensibly populates a table
server-side, but no table is displayed client side. I tried a couple of
other dynamically generated pages with no luck there either. The code is
provided below. Any ideas?
--
Regards,
Richard
======== AddingRows.aspx =============
<%@ Page language="c#" Codebehind="AddingRows.aspx.cs"
AutoEventWireup="false" Inherits="TestAddingRowsToTable.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<!-- meta statements deleted -->
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:Label id="Label1" runat="server" Width="205px">Testing Dynamicly
Adding Rows</asp:Label>
<HR width="100%" SIZE="1">
<asp:Table id="MyTable" runat="server" Width="122px"></asp:Table>
</form>
</body>
</HTML>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e)
{
for (int i=1; i<=2; i++)
{
TableRow r = new TableRow();
for (int j=1; j<=2; j++)
{
TableCell c = new TableCell();
c.Text = String.Format("Row {0}, Col (1}", i, j);
r.Cells.Add(c);
}
MyTable.Rows.Add(r);
}
}
</script>