How to render html string from razor view with model

This is sample example


using RazorEngine;


//this is for c# controller
 string text = System.IO.File.ReadAllText(System.IO.Path.Combine(Server.MapPath("~/Mvc/Views/SinCairForm/EmailTemplate.cshtml")));
                        emailBody = Razor.Parse(text, new { Message = "hello", Serial="2017-009", WebURL= "http://localhost:49557" });


//this is for view
<div>@Model.Message</div>
<div>@Model.Serial</div>

Comments

Popular posts from this blog

How can we find .net version in server or computer

Develop recaptcha validation in c# backend and website

Download csv file in client side with mvc controller