Get html data from database and put it to a page as HTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mysticfalcon
    New Member
    • Jan 2013
    • 2

    Get html data from database and put it to a page as HTML

    Hello friends,

    I'm putting html data via CKEditor (a richedittextbox ) to my database as string.

    I want to put retrievet data AS HTML to my page. How can I do this?

    My current code is:
    Code:
    Me.myContent.InnerHtml = Server.HtmlDecode(myVar)
    
    myContent = a Div with runat=server
    myVar = retrieved data from database
    Result is:
    Code:
    <h1>
      <img alt="Saturn V carrying Apollo 11" class="right" src="http://bytes.com/assets/sample.jpg" /> 
      Apollo 11
    </h1> 
    <p>
      <b>Apollo 11</b> was the spaceflight that landed the first humans, Americans <a href="http://en.w.... etc. etc.
    Last edited by Frinavale; Jan 24 '13, 02:19 PM. Reason: Added code tags.
  • Mysticfalcon
    New Member
    • Jan 2013
    • 2

    #2
    I have solved problem as this:


    changed
    Code:
    Me.myContent.InnerHtml = Server.HtmlDecode(myVar)
    to
    Code:
    Me.myContent.InnerHtml = HttpUtility.HtmlDecode(myVar)
    Last edited by Frinavale; Jan 24 '13, 02:20 PM. Reason: Added code tags.

    Comment

    Working...