My application has built in ASP.NET MVC 5. Now, what I am trying to do is that application retrieves the text data from database and generate some html text. So, i can set that html text into a specific div element by assigning innerHtml property. But, when i try to assign that html text into that div it doesn't render. It shows html text.

enter image description here

This is my code

<script type="text/javascript">
    var elem = document.getElementById('discussion');
    elem.innerHTML = "@Server.HtmlDecode(@discussionDiv.ToString())";
</script>

Is there any better way that can i use to set that html text into my dom element?

Related posts

Recent Viewed