@Html.TextBoxFor(m => m.Name) is not working in razorengine

Dec 24, 2015 at 2:23 AM
I am using razorEngine. to implement dynamic views and layout in my application.

when i used the below code i am unable to get the output getting error " try another modelType (for example 'null' to make the model dynamic)."

LoadedTemplateSource source = new LoadedTemplateSource(System.IO.File.ReadAllText(@"E:\layout\layout2.cshtml"), null);
        Engine.Razor.AddTemplate("demo", source);
        Engine.Razor.Compile("demo", null);
        string template = "Hello @Html.TextBoxFor(m => m.Name)";
        MyModel model = new MyModel { ModelProperty = "World" };
        string result = Razor.Parse(template, model);

Please help me how to solve the problem