[Mono-list] self modifying tables

Gonzalo Paniagua Javier gonzalo@ximian.com
14 Feb 2003 18:19:59 +0100


--=-AuWbKBF6VCrWyJQEsyXv
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

El vie, 14 de 02 de 2003 a las 17:36, dietmar escribió:
> I want to implement self modifying tables with asp.net, but the attached
> examples does not work. Maybe someone can point me to the right
> solution?

test3.aspx will not work because PreRender is called after event
processing. So the controls added in that stage will never get post
events.

A slightly modified version of test2.aspx is attached and does what you
expect.

-Gonzalo


--=-AuWbKBF6VCrWyJQEsyXv
Content-Description: 
Content-Disposition: attachment; filename=test2.aspx
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<%@ Page Language="C#" %>
<html>
<head>
<script runat="server">

TableRow row;

void Clicked (Object sender, EventArgs e)	
{
	Console.WriteLine ("ADD database entry");
	TableCell cell = new TableCell ();
	LinkButton lb = new LinkButton ();
	lb.Text = "ADDED ENTRY";
	lb.Click += new EventHandler (Clicked);
	cell.Controls.Add (lb);
	row.Cells.Add (cell);
}

void Page_Load (object o, EventArgs e)
{
	TableCell cell;

	Console.WriteLine ("PAGELOAD");

	row = new TableRow ();
	t1.Rows.Add (row);
		
	cell = new TableCell ();
	LinkButton lb = new LinkButton ();
	lb.Text = "TES1";
	lb.Click += new EventHandler (Clicked);
	cell.Controls.Add (lb);
	row.Cells.Add (cell);
}

</script>


<title>LinkButton as submit and command</title>
</head>
<body>
<form runat="server">
<asp:Table id="t1" runat="server"/>
</form>
</body>
</html>


--=-AuWbKBF6VCrWyJQEsyXv--