Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Step by Step tutorials and PluralSight Videos covering MVC 3
https://www.asprangers.com/post/2012/03/31/Resources-to-learn-MVC-3.aspx
Comments
- Anonymous
April 04, 2012
I am having a requirement where i want to load my .cshtml file from the database. My .cshtml file comes from the database as filestream which I am able to parse as normal string which looks as below: <h2>SecondPage You are from .cshtml Page</h2> @{Html.RenderAction("Left", "Left");} I need to show this web page for which i am trying to parse the .cshtml file as // my SP which will return byte array from database byte[] objContext = byte[])objdbmcptestEntities.GetFile(1).SingleOrDefault().FileData; var template = System.Text.Encoding.ASCII.GetString(objContext); //var template = "@{ @:The day is: @DateTime.Now.DayOfWeek. It is a <b>great</b> day!}"; //This code works fine //The code below does`t work var template = "Hello @Model.Name! Welcome to Razor!<h2>SecondPage You are from code behind</h2><div>@Model.Name</div><div>@{Html.RenderAction("Left", "Left");}</div>"; return Razor.Parse(template, new { Name = "World" }); Please give me some solution ASAP.