Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6116715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:14:18+00:00 2026-05-23T15:14:18+00:00

In my mvc application, I have a view in which the content for the

  • 0

In my mvc application, I have a view in which the content for the view will have to be rendered in html format. html string will be obtained form the model in the view. How can i rener the html mark up as such in view?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:14:18+00:00Added an answer on May 23, 2026 at 3:14 pm

    Have a read through: http://www.asp.net/mvc/tutorials/asp-net-mvc-views-overview-cs to see an example of the ASPX view engine rendering HTML.

    You shouldn’t be building HTML in the model (or in the controller and putting it into the model).

    Update: as Jamie Dixon has mentioned, there are situations in which business properties of the model will contain HTML.

    Generally, speaking:
    The model should contain properties and business logic.
    The views will render the HTML that you need.
    The controller calls the business logic needed and passes the model to the correct view.

    If, in the view, you wish to write out a heading based on a property called Title on the Model, you can use this:

    <h1><%: Model.Title %></h1>
    

    or if you are storing a HTML string in a property called StoredHtml:

    <div>
        <%= Model.StoredHtml%>
    </div>
    

    Note that <%= has been used rather than <%:, as <%: will encode HTML for security reasons (like <script> tags being saved).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC application view that is generating quite a large HTML table
I have written a VERY simple MVC application which just displays a single string
In an ASP.NET MVC application where I have the following model.. public class EventViewModel
I have an MVC application which is my marketing website, and two other regular
I have an MVC application which has a set of fields for contact details
I have a new MVC 4 Application with a fairly basic View/Controller. The associated
I have a view which includes <link href=<%=ScriptUrl.ToUrl(~/Content/App_Themes/Blue/Sales_Blue.css)%> rel=stylesheet type=text/css /> in the head
In MVC Application, I want to render some parts of form dynamically (which are
I have a CodeIgniter MVC application. I have a model called city that has
I have created a MVC application its working fine. I have created a view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.