Custom Control Property returning "Encoded" text from textarea box

Discussion in 'ASP .Net' started by Earl Teigrob, Apr 28, 2004.

  1. Earl Teigrob

    Earl Teigrob Guest

    I have a custom control that creates a textarea child control and diplays it
    to the user. The control is defined as follows

    System.Web.UI.HtmlControls.HtmlTextArea TextArea1;

    I have a property called "Text" that sets and getis it value, as follows:

    [Bindable(true),

    Category("Appearance"),

    DefaultValue("")]

    public string Text

    {


    get

    {

    EnsureChildControls();

    return TextArea1.Value;

    }

    set

    {

    EnsureChildControls();

    TextArea1.Value = value;

    }

    }

    The problem is that when I gete the contents of the textarea bos from the
    "Text" property, if the text contains html tags, they are changed into their
    html equivelents (< becomes &lt etc)

    Why is this happening ahd how can I stop it???

    Thanks

    Earl
     
    Earl Teigrob, Apr 28, 2004
    #1
    1. Advertising

  2. Earl Teigrob

    Natty Gur Guest

    Hi,

    you can use Server.HtmlDecode() in your property:

    <code>
    return Server.HtmlDecode(TextArea1.Value);
    </code>

    Natty Gur[MVP]

    blog : http://weblogs.asp.net/ngur
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Apr 29, 2004
    #2
    1. Advertising

  3. Earl Teigrob

    Earl Teigrob Guest

    Thanks Natty,

    "Natty Gur" <> wrote in message
    news:...
    > Hi,
    >
    > you can use Server.HtmlDecode() in your property:
    >
    > <code>
    > return Server.HtmlDecode(TextArea1.Value);
    > </code>
    >
    > Natty Gur[MVP]
    >
    > blog : http://weblogs.asp.net/ngur
    > Mobile: +972-(0)58-888377
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Earl Teigrob, Apr 29, 2004
    #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. Vinod I
    Replies:
    1
    Views:
    368
    Peter Blum
    Jan 31, 2004
  2. Vinod I
    Replies:
    1
    Views:
    381
    Brian K. Williams
    Feb 26, 2004
  3. Gnarlodious
    Replies:
    4
    Views:
    17,623
    elizas
    May 5, 2010
  4. Dean Brettle

    Possible bug: HtmlAnchor HRef property is not HTML encoded

    Dean Brettle, Dec 28, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    157
    Dean Brettle
    Dec 28, 2005
  5. Joel

    Encoded and Textarea

    Joel, Nov 27, 2003, in forum: ASP General
    Replies:
    1
    Views:
    106
Loading...

Share This Page