471,318 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

Less Than and Greater Than Brackets in Web Pages

I know in regular HTML within a web page, you can use the following to
display < output in the HTML output.

&lt output &gt

but, I'd rather not include any spaces between the less than and great than
signs, thus I want to see <outputinstead. So, I tried using:

&ltappsettings&gt

and only 1/2 of it works. I get the following output instead:

&ltappsettings>

How can I make it so that my output shows as <outputwith no spaces between
the less than sign and the first letter?
Sep 15 '08 #1
4 2069
Greg wrote:
&ltappsettings&gt

and only 1/2 of it works. I get the following output instead:

&ltappsettings>
It should be &lt;appsetting&gt; (note the semicolons).

Try that.
--
Rudy Velthuis http://rvelthuis.de

"Mother-in-law = A woman who destroys her son-in-law's peace of
mind by giving him a piece of hers." -- Anonymous.
Sep 15 '08 #2
Thanks, I literally just tried this a minute ago, and bingo, it works. Thanks.

"Rudy Velthuis" wrote:
Greg wrote:
&ltappsettings&gt

and only 1/2 of it works. I get the following output instead:

&ltappsettings>

It should be <appsetting(note the semicolons).

Try that.
--
Rudy Velthuis http://rvelthuis.de

"Mother-in-law = A woman who destroys her son-in-law's peace of
mind by giving him a piece of hers." -- Anonymous.
Sep 15 '08 #3
"Greg" <Ac**********@newsgroups.nospamwrote in message
news:76**********************************@microsof t.com...
>Greg wrote:
&ltappsettings&gt

and only 1/2 of it works. I get the following output instead:

&ltappsettings>

It should be <appsetting(note the semicolons).

Try that.
Thanks, I literally just tried this a minute ago, and bingo, it works.
Thanks.

"Rudy Velthuis" wrote:
Its unclear whether you are doing this in ASP.NET or not however if not you
can reference the System.Web.dll then you can use:-

string sOut = HttpUtility.HtmlEncode("<appsettings>");

This will save you having to hunt down all the characters that need html DTD
entities such as <, and &.

If you are doing this in an aspx page then the pages Server property can be
used:-

string sOut = Server.HtmlEncode("<appsettings>");

--
Anthony Jones - MVP ASP/ASP.NET

Sep 16 '08 #4
With further research last night I came across this method and it more
appropiately follow the path that I am taking, using ASP.NET pages. Thanks
for the reply.

"Anthony Jones" wrote:
"Greg" <Ac**********@newsgroups.nospamwrote in message
news:76**********************************@microsof t.com...
Greg wrote:

&ltappsettings&gt

and only 1/2 of it works. I get the following output instead:

&ltappsettings>

It should be <appsetting(note the semicolons).

Try that.
Thanks, I literally just tried this a minute ago, and bingo, it works.
Thanks.

"Rudy Velthuis" wrote:

Its unclear whether you are doing this in ASP.NET or not however if not you
can reference the System.Web.dll then you can use:-

string sOut = HttpUtility.HtmlEncode("<appsettings>");

This will save you having to hunt down all the characters that need html DTD
entities such as <, and &.

If you are doing this in an aspx page then the pages Server property can be
used:-

string sOut = Server.HtmlEncode("<appsettings>");

--
Anthony Jones - MVP ASP/ASP.NET

Sep 16 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jeremy Howard | last post: by
8 posts views Thread by Al Reynolds | last post: by
8 posts views Thread by Al Reynolds | last post: by
15 posts views Thread by Murt | last post: by
11 posts views Thread by Martin Jørgensen | last post: by
16 posts views Thread by Cory Nelson | last post: by
3 posts views Thread by ek | last post: by

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.