473,513 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.
Nov 19 '05 #1
3 1778
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.
"RN" <re*************@please.com> wrote in message
news:57******************@twister.socal.rr.com...
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.

Nov 19 '05 #2
did you try using a different new litbr for each row instead of inserting the
same one?
Hth..
R. Thomas

"RN" wrote:
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.

Nov 19 '05 #3
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

"R. Thomas, aka Xtreme.Net" wrote:
did you try using a different new litbr for each row instead of inserting the
same one?
Hth..
R. Thomas

"RN" wrote:
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.

Nov 19 '05 #4

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

Similar topics

19
1842
by: Craig | last post by:
I have a 3rd party product that is quite old. It produces reports dynamically via the web. It users templates to do this. They are very basic, one looks like this. <html> <head>
0
944
by: Alessandro Rinaldi | last post by:
Hi all, what's wrong in this ? I added a simple Control with viewstate (ie : label, or my User control... ) dinamically in the controls collection of a TD cell created dynamically too, i lose...
2
2208
by: Juan Romero | last post by:
Hey guys, I am working on a web custom control that basically draws a table (ASP Table) with a few child controls in the cells. I have a command button inside one of these cells. The problem I...
1
1274
by: Wade | last post by:
Hi all, I am dynamically adding a link button to a page, but for some reason it is not raising the click event in the code behind. Here are some snippets from my code -- any help is greatly...
2
2409
by: buran | last post by:
Dear ASP.NET Programmers, I have a HTML table (running as server control with the control ID: tblInsertSP). The table has 16 rows with textboxes. Depending on the value of the ddlSPType, which...
2
1316
by: VB Programmer | last post by:
I have a bunch of hyperlinks in a table cell and I set the valign to "middle", but they stay at the top. Any ideas? Here's the html... Thanks in advance! <TABLE id="Table1" cellSpacing="0"...
2
2782
by: Bass Pro | last post by:
How do I access a textbox when it was added to a table cell? I've tried using the findcontrol function with no result. I create it as such... Dim myTable As Table = New Table Dim Row as...
0
1157
by: Umut Tezduyar | last post by:
I have a control derived from ComposeteDataBoundControl. Control doesn't retreive it's state information. I am going to frick out! What should I do more? I added two codes. One is for Default.aspx...
0
5273
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7161
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7539
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5089
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1596
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.