how to delimit html markup characters for a web control

Discussion in 'ASP .Net' started by Tim Zych, Nov 20, 2005.

  1. Tim Zych

    Tim Zych Guest

    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
     
    Tim Zych, Nov 20, 2005
    #1
    1. Advertising

  2. "Tim Zych" <> wrote in
    news::

    > 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.)

    --
    Hope this helps.

    Chris.
    -------------
    C.R. Timmons Consulting, Inc.
    http://www.crtimmonsinc.com/
     
    Chris R. Timmons, Nov 21, 2005
    #2
    1. Advertising

  3. Tim Zych

    Tim Zych Guest

    thanks!

    "Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
    news:Xns9714C1C7C95A3crtimmonscrtimmonsin@207.46.248.16...
    > "Tim Zych" <> wrote in
    > news::
    >
    > > 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.)
    >
    > --
    > Hope this helps.
    >
    > Chris.
    > -------------
    > C.R. Timmons Consulting, Inc.
    > http://www.crtimmonsinc.com/
     
    Tim Zych, Nov 21, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    7,104
    Scott M.
    Oct 11, 2003
  2. Andreas Prilop
    Replies:
    0
    Views:
    384
    Andreas Prilop
    May 30, 2005
  3. Replies:
    17
    Views:
    437
  4. Neil8Ken

    Many &nbsp; characters added to markup

    Neil8Ken, Apr 23, 2008, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    760
    Neil8Ken
    Apr 23, 2008
  5. Mike G.
    Replies:
    1
    Views:
    135
    Tad McClellan
    Aug 19, 2003
Loading...

Share This Page