how to delimit html markup characters for a web control

T

Tim Zych

I have a code library that I developed in ASP.Net. The code displays in a
web form via a System.Web.UI.WebControls.Label.

It works well because I can search for code snippets and then highlight the
searched results by wrapping color tags around them much like the result
google provides when you search.

However, I tried to save the function I used to perform that action, and it
has characters such as "<", "/" and ">", and the control doesn't display
them. I suppose it's interpreting them as html and applying them to the html
control.

How do I display markup characters in a web control? Is there some sort of
delimiter? I know next to nothing about html.

thanks
 
C

Chris R. Timmons

I have a code library that I developed in ASP.Net. The code
displays in a web form via a System.Web.UI.WebControls.Label.

It works well because I can search for code snippets and then
highlight the searched results by wrapping color tags around
them much like the result google provides when you search.

However, I tried to save the function I used to perform that
action, and it has characters such as "<", "/" and ">", and the
control doesn't display them. I suppose it's interpreting them
as html and applying them to the html control.

How do I display markup characters in a web control? Is there
some sort of delimiter? I know next to nothing about html.

Tim,

Use HttpUtility.HtmlEncode to convert characters like "<", "/" and
">" to their "displayable" equivalents (&lt; for <, &gt; for >, etc.)
 
T

Tim Zych

thanks!

Chris R. Timmons said:
Tim,

Use HttpUtility.HtmlEncode to convert characters like "<", "/" and
">" to their "displayable" equivalents (&lt; for <, &gt; for >, etc.)
 

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,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top