Visual Studio Code C# MVC Application - How to view Marked up HTML Code as if hard coded in an HTML Page...

BillNew 36 Reputation points
2023-03-28T23:21:40.2433333+00:00

Attempting to do code behind in a Visual Studio Code Application when I have done my own HTML Markup code in a routine in the C# code:

.

.

.

@ViewData["abc"] = "<br/>Message<br/Message2<br/>Message3";
.

.

.

OR

.

.

.

@ViewData["abc"] = "<table><tr><td>1</td></tr><tr><td>2</td></tr></table>";

.

.

.

My .CSHTML Page to render the data has:

.

.

.

@ViewData["abc"]

.

.

.

When running my application, I can see the data used in my code but it will not render as if on a hard coded HTML Page. Can take the exact data and paste it between <html> and </html> tags and it works properly.

Even went so far as to create an ASPX Application in Visual Studio 2015 with the same result.

For my application, I am restricted to using Microsoft Plug-ins for C# and Live Preview Only at this point in time.

Any ideas on HOW to resolve this issue without using Python or another Plug-in for Visual Studio Code? Java or JavaScript would be an acceptable method if it would work properly!

Thanks in advance for any helpful hints!

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,254 questions
{count} votes

1 answer

Sort by: Most helpful
  1. BillNew 36 Reputation points
    2023-03-29T13:32:58.5+00:00

    Thank you.

    @Html.Raw(...) work well.