HTMLTable\Cell\AddControl

G

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
 
G

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 said:
tblDisplay.Rows[0].Cells[0].Controls.Add(aCtl);

Eliyahu

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
 
E

Eliyahu Goldin

The Controls collection has Clear, Remove and RemoveAt methods. Use whatever
is appropriate.

Eliyahu

gh said:
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 said:
tblDisplay.Rows[0].Cells[0].Controls.Add(aCtl);

Eliyahu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top