gaurav gaurav - 4 months ago 47
ASP.NET (C#) Question

creating view in mvc

I want to create

programmatically through c# and want to place it in a
View folder
in my
MVC project
. If this is possible then please tell me how can i implement such logic?


You can implement IView interface and build your own view:

public class HomeController : Controller
    public class MyCustomView : IView
        public void Render(ViewContext viewContext, System.IO.TextWriter writer)
            writer.WriteLine("view's content");

    public ActionResult Index()
        return View(new MyCustomView());