Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The answers I've found so far seem to indicate that whatever is in the System.Web.... namespaces, you cannot access whatever is necessary to say "here's a view and model, give me the HTML."

Instead, people point to RazorEngine or MvcMailer.

Really? I can't access the parsing engine without going to some third party utility??? I find that hard to believe.
Posted

1 solution

Hello,

I think it is possible...

Create a new partial view and a matching new layout.

In the partial view use the layout
HTML
@model Myapp.EmailModel
@{
  Layout="~/Views/Shared/Email_layout.cshtml"
}


in the layoiut, render the partial view...

HTML
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Email</title>
</head>
<body>
        @RenderBody()        
</body>
</html>


now you can use this with @Html.Partial anywhere you like..

@Html.Partial("EmaillView", emailModel)



Valery.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900