473,406 Members | 2,619 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,406 software developers and data experts.

how to render <br> tag from a user control?

I am using HtmlGenericControl to render html tags like <divand
<span>.

the problem is the <brtag does not render correctly when I use this
method. ( it renders as <br></br>, which is seen by the browser as 2
consecutive <brtags.

public class Html_br : HtmlGenericControl
{
public Html_br()
: base("br")
{
}
}

How can I render the <brtag so that I can use Controls.Add to add a
<brtag to the output of my user control?

thanks,

-Steve

Jun 29 '07 #1
6 2368
"Steve Richter" <St************@gmail.comwrote in message
news:11*********************@k79g2000hse.googlegro ups.com...
the problem is the <brtag does not render correctly when I use this
method. ( it renders as <br></br>, which is seen by the browser as 2
consecutive <brtags.
Yes, it would do... The <brtag is deprecated these days, and XHTML
compliance needs it to be self-closing.
How can I render the <brtag so that I can use Controls.Add to add a
<brtag to the output of my user control?
<br />
--
http://www.markrae.net

Jun 29 '07 #2
On Jun 29, 4:02 pm, "Mark Rae" <m...@markNOSPAMrae.netwrote:
"Steve Richter" <StephenRich...@gmail.comwrote in message

news:11*********************@k79g2000hse.googlegro ups.com...
the problem is the <brtag does not render correctly when I use this
method. ( it renders as <br></br>, which is seen by the browser as 2
consecutive <brtags.

Yes, it would do... The <brtag is deprecated these days, and XHTML
compliance needs it to be self-closing.
deprecated? jeez. what was it too easy and unambiguous? ;)

how do I start text on a new line?
<span style="display:block;">line 1</span>
<span style="display:block;">line 2</span>

or has <spanbeen deprecated also?

thanks,

-Steve

Jun 29 '07 #3
"Steve Richter" <St************@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
"...Serves as the abstract base class for HTML server controls that
map to HTML elements that are required to have an opening and a
closing tag. ..."

<brdoes not support the closing tag.
Yes it does:
http://www.w3schools.com/xhtml/xhtml_howto.asp
--
http://www.markrae.net

Jun 29 '07 #4
"Steve Richter" <St************@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
>Yes, it would do... The <brtag is deprecated these days, and XHTML
compliance needs it to be self-closing.

deprecated? jeez. what was it too easy and unambiguous? ;)
No - it was non-standards compliant...
how do I start text on a new line?
<span style="display:block;">line 1</span>
<span style="display:block;">line 2</span>

or has <spanbeen deprecated also?
Have you tried <div>...</div>
--
http://www.markrae.net

Jun 29 '07 #5
Hi Steve,

There are few resolutions to the problem:

1. Depending on the browser caps you will get <bror <br/>
public class HtmlBr : System.Web.UI.HtmlControls.HtmlControl
{
protected override void Render(HtmlTextWriter writer)
{
writer.WriteBreak();
}
}

2. Insetad of deriving simply use LiteralControl

rendring for HTML 4.0
myContainer.Controls.Add(new LiteralControl("<br>"));
or for XHTML 1.0/1.1
myContainer.Controls.Add(new LiteralControl("<br/>"));
Please note you and Mark are both right because you're talking abount HTML
4.01 standard (<br>) and Mark is talking about XHTML <br/(all tags must be
valid from XML point of view)

Regards

Milosz

--
Milosz
"Steve Richter" wrote:
I am using HtmlGenericControl to render html tags like <divand
<span>.

the problem is the <brtag does not render correctly when I use this
method. ( it renders as <br></br>, which is seen by the browser as 2
consecutive <brtags.

public class Html_br : HtmlGenericControl
{
public Html_br()
: base("br")
{
}
}

How can I render the <brtag so that I can use Controls.Add to add a
<brtag to the output of my user control?

thanks,

-Steve

Jun 30 '07 #6
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:77**********************************@microsof t.com...
and Mark is talking about XHTML <br/>
Actually, it's <br />

The space is important for some browsers...
--
http://www.markrae.net

Jun 30 '07 #7

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

Similar topics

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...
6
by: Lasse | last post by:
I have done this simple function, it seems to work as intended, to solve a problem i have had for a while. I couldnt find any sample around that was working for me. I would like to test it with...
0
by: CoreyMas | last post by:
Hello everyone, I am in a bit of a dilema trying to write an HTML <br> tag into a panel or placeholder. Here is the situation I have 4 tables that represent 4 levels of data (level4 is...
7
by: noor.rahman | last post by:
I have an XML file that stores data from an HTML form. I use XSL to display the data in HTML format. The data may have newline characters. However, XSL is not displaying the newlines properly in...
0
by: George Ter-Saakov | last post by:
I have a composite control. Which has 2 parts. Under some conditions first part must be shown sometimes another. So naturally I used 2 Panel object. And hide one of them. The problem is that...
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: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all...
1
by: Winshent | last post by:
I have a multi line text in an admin page on my cms. I am trying to capture carriage returns as and replace them with <p></p> bfore the string gets written to the database. I have tried all...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
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
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...

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.