E
encoad
Hi everybody, I'm hoping you can help me understand why this doesn't
work, and perhaps someone can suggest a way for me to solve my problem.
Essentially, I'm trying to add a row with a single cell twice in a
table. Both cells are identical and therefore I don't want to
duplicate everything in the code. My function determines at runtime if
there should be two identical cells or just a single cell. Here is
some sample code, which only displays the contents of a single cell.
protected void Page_Load(object sender, EventArgs e)
{
Table atable = new Table();
TableRow arow = new TableRow();
TableCell acell = new TableCell();
HyperLink alink = new HyperLink();
alink.NavigateUrl = "aaaaaaaaaa";
alink.Text = "aaaaaaaaaaaaaaaaaaaaaaa";
acell.Controls.Add(alink);
arow = new TableRow();
arow.Controls.Add(acell);
atable.Controls.Add(arow);
arow = new TableRow();
arow.Controls.Add(acell);
atable.Controls.Add(arow);
Page.Controls.Add(atable);
}
Now from what I gather, when I do a object.Controls.Add(object) it is
infact moving the object to the new control. So how do I go about
putting the contents of a cell into two different rows in a table? My
exact application is that I want my users to have the option to have a
combination of [menu] - {Gallery Picture} - [menu], with the choices of
displaying the menu on Top, Bottom or Top&Bottom at the same time.
Any help would be appreciated,
Thanks,
Nicholas
work, and perhaps someone can suggest a way for me to solve my problem.
Essentially, I'm trying to add a row with a single cell twice in a
table. Both cells are identical and therefore I don't want to
duplicate everything in the code. My function determines at runtime if
there should be two identical cells or just a single cell. Here is
some sample code, which only displays the contents of a single cell.
protected void Page_Load(object sender, EventArgs e)
{
Table atable = new Table();
TableRow arow = new TableRow();
TableCell acell = new TableCell();
HyperLink alink = new HyperLink();
alink.NavigateUrl = "aaaaaaaaaa";
alink.Text = "aaaaaaaaaaaaaaaaaaaaaaa";
acell.Controls.Add(alink);
arow = new TableRow();
arow.Controls.Add(acell);
atable.Controls.Add(arow);
arow = new TableRow();
arow.Controls.Add(acell);
atable.Controls.Add(arow);
Page.Controls.Add(atable);
}
Now from what I gather, when I do a object.Controls.Add(object) it is
infact moving the object to the new control. So how do I go about
putting the contents of a cell into two different rows in a table? My
exact application is that I want my users to have the option to have a
combination of [menu] - {Gallery Picture} - [menu], with the choices of
displaying the menu on Top, Bottom or Top&Bottom at the same time.
Any help would be appreciated,
Thanks,
Nicholas