473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

HTMLTable\Cell\AddControl

gh
I have a HTML Table with 1 row and 1 column. I have a control I want to
add to the cell at runtime based on a condition. I can get the control
added by creating a row and cell and using the code below:

cell.Controls.Add(aCtl);
row.Cells.Add(cell);
tblDisplay.Rows.Add(row);

Is there a way to add the control to the row and cell already setup in
the table? When I try, tblDisplay.Controls.Add(aCtl), I get the
following error message:
'HtmlTable' cannot have children of type 'display_ascx'.
TIA
Jan 26 '06 #1
3 5333
tblDisplay.Rows[0].Cells[0].Controls.Add(aCtl);

Eliyahu

"gh" <gh@at.ne> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
I have a HTML Table with 1 row and 1 column. I have a control I want to
add to the cell at runtime based on a condition. I can get the control
added by creating a row and cell and using the code below:

cell.Controls.Add(aCtl);
row.Cells.Add(cell);
tblDisplay.Rows.Add(row);

Is there a way to add the control to the row and cell already setup in the
table? When I try, tblDisplay.Controls.Add(aCtl), I get the following
error message:
'HtmlTable' cannot have children of type 'display_ascx'.
TIA

Jan 26 '06 #2
gh
Eliyahu:

If I have a control in the cell and replace it using
tblDisplay.Rows[0].Cells[0].Controls.Add(aCtl);

It adds the control below the existing one. How do I remove the
existing control first?

TIA

Eliyahu Goldin wrote:
tblDisplay.Rows[0].Cells[0].Controls.Add(aCtl);

Eliyahu

"gh" <gh@at.ne> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
I have a HTML Table with 1 row and 1 column. I have a control I want to
add to the cell at runtime based on a condition. I can get the control
added by creating a row and cell and using the code below:

cell.Controls.Add(aCtl);
row.Cells.Add(cell);
tblDisplay.Rows.Add(row);

Is there a way to add the control to the row and cell already setup in the
table? When I try, tblDisplay.Controls.Add(aCtl), I get the following
error message:
'HtmlTable' cannot have children of type 'display_ascx'.
TIA


Jan 26 '06 #3
The Controls collection has Clear, Remove and RemoveAt methods. Use whatever
is appropriate.

Eliyahu

"gh" <gh@at.ne> wrote in message
news:ey*************@TK2MSFTNGP15.phx.gbl...
Eliyahu:

If I have a control in the cell and replace it using
tblDisplay.Rows[0].Cells[0].Controls.Add(aCtl);

It adds the control below the existing one. How do I remove the existing
control first?

TIA

Eliyahu Goldin wrote:
tblDisplay.Rows[0].Cells[0].Controls.Add(aCtl);

Eliyahu

"gh" <gh@at.ne> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
I have a HTML Table with 1 row and 1 column. I have a control I want to
add to the cell at runtime based on a condition. I can get the control
added by creating a row and cell and using the code below:

cell.Controls.Add(aCtl);
row.Cells.Add(cell);
tblDisplay.Rows.Add(row);

Is there a way to add the control to the row and cell already setup in
the table? When I try, tblDisplay.Controls.Add(aCtl), I get the
following error message:
'HtmlTable' cannot have children of type 'display_ascx'.
TIA



Jan 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.