why won't this control get added to the table cell?

R

RN

I have a table cell in which I add a few things, but I want a few HTML line
breaks (the <BR> tag) to separate these things. Sounds simple but I can't
get it to work.

Dim litBR as New Literal
litBR.text = "<BR><BR>"
MyTableCell.Controls.Add(CheckBoxControl)
MyTableCell.Controls.Add(litBR)
MyTableCell.Controls.Add(DataGridControl)
MyTableCell.Controls.Add(litBR)
MyTableCell.Controls.Add(ButtonControl)
MyTableCell.Controls.Add(litBR)


But in the HTML output, only the last litBR was added to the page. There
is no <BR><BR> between the checkbox and the datagrid and none between the
datagrid and the button. It only shows after the button. Why? When I
hover over the lines during debugging each line executes and it shows the
value of litBR.text does equal "<BR><BR>" throughout. The checkbox and
datagrid and button all display properly but with no spacing between. I'll
even take a workaround but I need to stay within this table cell.
 
R

RN

I figured out it should be a "LiteralControl" object and not a "Literal"

I'm surprised it worked at all on the last line, which made it harder to
debug because it worked on one line but not the other two.
 
G

Guest

did you try using a different new litbr for each row instead of inserting the
same one?
Hth..
R. Thomas
 
G

Guest

We did a small test. That should indeed work...

Table objTable = new wc.Table();
objTable.BorderWidth = 10;
LiteralControl objBr = new LiteralControl("<br><br>");
LiteralControl objBr2 = new LiteralControl("<br><br>");
Button objButton = new Button();
objButton.Text = "a text";
Button objButton2 = new Button();
objButton2.Text = "another text";
TableCell objCell1 = new TableCell();
objCell1.Controls.Add(objButton);
objCell1.Controls.Add(objBr);
objCell1.Controls.Add(objButton2);
objCell1.Controls.Add(objBr2);
TableRow objRow = new TableRow();
objRow.Cells.Add(objCell1);
objTable.Rows.Add(objRow);
Panel1.Controls.Add(objTable);

Kind regards,
Nikander & Margriet Bruggeman
 

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,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top