[Mono-list] self modifying tables
dietmar
dietmar@ximian.com
14 Feb 2003 17:36:42 +0100
--=-2kZ4/RkcwGkCXrhIYHRw
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
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?
- Dietmar
--=-2kZ4/RkcwGkCXrhIYHRw
Content-Disposition: attachment; filename=test2.aspx
Content-Type: text/html; name=test2.aspx; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
<%@ Page Language="C#" %>
<html>
<head>
<script runat="server">
bool add_entry = false;
void Clicked (Object sender, EventArgs e)
{
Console.WriteLine ("ADD database entry");
add_entry = true;
}
// example 1: Clicked is called after Page_Load, so add_entry is always false
void Page_Load (object o, EventArgs e)
{
TableRow row;
TableCell cell;
Console.WriteLine ("PAGELOAD");
row = new TableRow ();
cell = new TableCell ();
LinkButton lb = new LinkButton ();
lb.Text = "TES1";
lb.Click += new EventHandler (Clicked);
cell.Controls.Add (lb);
row.Cells.Add (cell);
if (add_entry) {
Console.WriteLine ("PAGELOAD ADD");
cell = new TableCell ();
lb = new LinkButton ();
lb.Text = "ADDED ENTRY";
lb.Click += new EventHandler (Clicked);
cell.Controls.Add (lb);
row.Cells.Add (cell);
}
t1.Rows.Add (row);
}
</script>
<title>LinkButton as submit and command</title>
</head>
<body>
<form runat="server">
<asp:Table id="t1" runat="server"/>
</form>
</body>
</html>
--=-2kZ4/RkcwGkCXrhIYHRw
Content-Disposition: attachment; filename=test3.aspx
Content-Type: text/html; name=test3.aspx; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
<%@ Page Language="C#" %>
<html>
<head>
<script runat="server">
bool add_entry = false;
void Clicked (Object sender, EventArgs e)
{
Console.WriteLine ("ADD database entry");
add_entry = true;
}
// example 2: creating linkbuttons in PreRender does not work
void Page_PreRender (object o, EventArgs e)
{
TableRow row;
TableCell cell;
Console.WriteLine ("PAGELOAD");
row = new TableRow ();
cell = new TableCell ();
LinkButton lb = new LinkButton ();
lb.Text = "TES2";
lb.Click += new EventHandler (Clicked);
cell.Controls.Add (lb);
row.Cells.Add (cell);
if (add_entry) {
Console.WriteLine ("PAGELOAD ADD");
cell = new TableCell ();
lb = new LinkButton ();
lb.Text = "ADDED ENTRY";
lb.Click += new EventHandler (Clicked);
cell.Controls.Add (lb);
row.Cells.Add (cell);
}
t2.Rows.Add (row);
}
</script>
<title>LinkButton as submit and command</title>
</head>
<body>
<form runat="server">
<asp:Table id="t1" runat="server"/>
<asp:Table id="t2" runat="server"/>
</form>
</body>
</html>
--=-2kZ4/RkcwGkCXrhIYHRw--