1

I want to display a blog page dynamically from my database,the row which I am retrieving contains html tags so it's displaying the raw html data along with tags,but i want to display it as a page.At present it is displaying like this.

<p>In this article, we'll run down 10 tips you must note before you board a plane. Remember, the primary goal of each of the items on this list is to benefit the traveler, but these tips will also make the whole in-flight experience a lot more comfortable and relaxed.</p>                        <h4>Take an Water bottle</h4>                        <p>Spending countless hours on the plane dehydrates your body and skin. My tip is to take a stainless steel water bottle with you that you're able to fill up either just before boarding or on the plane by asking the flight attendant. Most airports have water fountains near the boarding gates. Just make sure that your bottle is empty when you go through the screening points.</p>                        <img

I want it do be displayed like a page with images being generated on its own. I have tried using Literal Control but it's not working,I have google about this but didn't get a reasonable solution.

There are alot of ways to display the same in asp.net MVC but could'nt find anything for weforms

I would be much obliged if any one could please help me out with this.

2 Answers 2

1

Have a markup like this:

<html>
    <body bgcolor="yellow">
        <%MyClass.MyFunction()%>
    </body>
</html>

Naturally, MyClass.MyFunction should return the html loaded from the database.

Sign up to request clarification or add additional context in comments.

1 Comment

No, the function should be created on server side, as you are reading from the database.
0

Take one div in web page

  <div id="webcontent" runat="server"></div>

in Conding Side,assign your string or data fetched from DB to div.

 string str =
    "Please enter your name:<br/>" +
    "<input type='text' name='userName'/>";

 webcontent.InnerHtml = str;

If you want to use javascript and deal with your div, dont forget to set its ClientIdMode to Static:

  <div id="webcontent" runat="server" ClientIdMode="Static"></div>

2 Comments

Thanks for your quick response i tried your example but it doesn't seem to work.Its returning html tag format like this.<p>Some text</p> or <img src="dummy.png"/> but not the rendered image
Actually, it is working fine for all HTML Tag.But can not load Image.Otherwise , Exclude Image , it gives perfect HTML output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.