HtmlEncode bound data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    HtmlEncode bound data

    Hi,

    I have a gridview where I am hand binding the data.

    In my view, I have a label. It has the text as text='<%# Bind("MyField")
    %>'

    I have incoming data that may contain < and >. I need to HTML Encode this,
    but I can't get it to work.

    text='<%# Server.HtmlEnco de(Bind("MyFiel d")) %>'

    I have tried changing the Bind to DataBinder.Eval (Container.Data Item,
    "MyField") and wrapping the HtmlEncode around it, but it doesn't work.

    What should I be doing?

    --
    Best regards,
    Dave Colliver.

    ~~
    http://www.FOCUSPortals.com - Local franchises available


  • David

    #2
    Re: HtmlEncode bound data

    I guess I have a problem and no easy solution...

    Anybody? Even if just a thought to try and get it working?
    --
    Best regards,
    Dave Colliver.

    ~~
    http://www.FOCUSPortals.com - Local franchises available



    "David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
    news:eoM9SpRqIH A.2520@TK2MSFTN GP02.phx.gbl...
    Hi,
    >
    I have a gridview where I am hand binding the data.
    >
    In my view, I have a label. It has the text as text='<%# Bind("MyField")
    %>'
    >
    I have incoming data that may contain < and >. I need to HTML Encode this,
    but I can't get it to work.
    >
    text='<%# Server.HtmlEnco de(Bind("MyFiel d")) %>'
    >
    I have tried changing the Bind to DataBinder.Eval (Container.Data Item,
    "MyField") and wrapping the HtmlEncode around it, but it doesn't work.
    >
    What should I be doing?
    >
    --
    Best regards,
    Dave Colliver.

    ~~
    http://www.FOCUSPortals.com - Local franchises available
    >

    Comment

    Working...