473,473 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Multiple TableCell.Conrols.Add(control) - How <BR> between them?

I'm adding several controls to a cell, but want them all to have a <BR>
between them. What's the easiest way?

I'm doing something like this:

HyperLink link = new Hyperlink();
//I setup the link target, navigateurl, etc here
Label lblDescription = new Label();
//I setup the lblDescription.Text here
Label lblName = new Label();
//I setup the lblName.Text here

TableCell cell = new TableCell();
cell.Controls.Add(link);
cell.Controls.Add(lblDescription);
cell.Controls.Add(lblName);
Now all the controls are just run together. Is there a property on the
controls to set to include <BR> after them? doing something like cell.Text
+= "<BR>" between them doesn't work, it erases to content of the cell...

Thanks in advance for the help,
Craig
Nov 18 '05 #1
4 3023
Craig wrote:
I'm adding several controls to a cell, but want them all to have a <BR>
between them. What's the easiest way?

TableCell cell = new TableCell();
cell.Controls.Add(link);
cell.Controls.Add(lblDescription);
cell.Controls.Add(lblName);


Hello Craig,

Between adding the link and lblDescription
and between adding the lblDescription and lblName,
you can add LiteralControls that contain the "<BR>".

Best regards,

Eric
Nov 18 '05 #2
You can set up a System.Web.UI.WebControls.Literal object to have the text
"<br/>" and then add this control to the controls collection of the cell.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Craig" <cs******@remoovdis.kc.rr.com> wrote in message
news:eW**************@TK2MSFTNGP11.phx.gbl...
I'm adding several controls to a cell, but want them all to have a <BR>
between them. What's the easiest way?

I'm doing something like this:

HyperLink link = new Hyperlink();
//I setup the link target, navigateurl, etc here
Label lblDescription = new Label();
//I setup the lblDescription.Text here
Label lblName = new Label();
//I setup the lblName.Text here

TableCell cell = new TableCell();
cell.Controls.Add(link);
cell.Controls.Add(lblDescription);
cell.Controls.Add(lblName);
Now all the controls are just run together. Is there a property on the
controls to set to include <BR> after them? doing something like cell.Text += "<BR>" between them doesn't work, it erases to content of the cell...

Thanks in advance for the help,
Craig

Nov 18 '05 #3
Take a look at Literal Control.

"Craig" <cs******@remoovdis.kc.rr.com> wrote in message news:<eW**************@TK2MSFTNGP11.phx.gbl>...
I'm adding several controls to a cell, but want them all to have a <BR>
between them. What's the easiest way?

I'm doing something like this:

HyperLink link = new Hyperlink();
//I setup the link target, navigateurl, etc here
Label lblDescription = new Label();
//I setup the lblDescription.Text here
Label lblName = new Label();
//I setup the lblName.Text here

TableCell cell = new TableCell();
cell.Controls.Add(link);
cell.Controls.Add(lblDescription);
cell.Controls.Add(lblName);
Now all the controls are just run together. Is there a property on the
controls to set to include <BR> after them? doing something like cell.Text
+= "<BR>" between them doesn't work, it erases to content of the cell...

Thanks in advance for the help,
Craig

Nov 18 '05 #4
Thanks guys - I have overlooked the literal control all this time
apparently... it works great.
"Craig" <cs******@remoovdis.kc.rr.com> wrote in message
news:eW**************@TK2MSFTNGP11.phx.gbl...
I'm adding several controls to a cell, but want them all to have a <BR>
between them. What's the easiest way?

I'm doing something like this:

HyperLink link = new Hyperlink();
//I setup the link target, navigateurl, etc here
Label lblDescription = new Label();
//I setup the lblDescription.Text here
Label lblName = new Label();
//I setup the lblName.Text here

TableCell cell = new TableCell();
cell.Controls.Add(link);
cell.Controls.Add(lblDescription);
cell.Controls.Add(lblName);
Now all the controls are just run together. Is there a property on the
controls to set to include <BR> after them? doing something like cell.Text += "<BR>" between them doesn't work, it erases to content of the cell...

Thanks in advance for the help,
Craig

Nov 18 '05 #5

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

Similar topics

1
by: Jimbo | last post by:
Hello, I'm not a perl programmer but I can kind of hack my way through some simple scripts. What I am trying to do is get it so a line break <br> is automatically placed when I hit the return...
4
by: fis | last post by:
Hi all, I've problem because there are needed break lines in my texts on the web site but i can't do it :( My pipeline looks like: XMS -> I18N -> XSLT -> HTML I have lot of texts in my...
25
by: Shannon Jacobs | last post by:
Maybe there is a simple trick here, and I'm not spotting it... Is there a guru of CSS hanging around here who can help out? The page in question has a multi-column table with a list of links in...
7
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no...
2
by: Quentin Huo | last post by:
Hi, I am trying to dynamically create <asp:TextBox> controls in a page, like: Label lbl = new Label(); TextBox1 = new TextBox();
7
by: Nathan Sokalski | last post by:
Something that I recently noticed in IE6 (I don't know whether it is true for other browsers or versions of IE) is that it renders <br/and <br></br> differently. With the <br/version, which is what...
11
by: Dameon99 | last post by:
HI, Im new to PHP completely but Im wanting to format the inputs for $order and $specialinstructions so that the /n of input is replaced with <br /> tags in the html. Ive heard about using nl2br()...
2
by: Defacta | last post by:
Hello ! How to delete all the new lines and replace them by <br>, because new lines involves Javacript Error, IE: facts_infos = "In 1972 he was done for murdering a colleague over a matter of...
1
by: xoinki | last post by:
hi all, I have a very large string with no space and i am putting that in a table cell. 1) Problem is that it does not wrap if a string does not have space in between and i want to force wrap...
0
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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
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
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.