gaurav gaurav - 1 year ago 95
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?

Answer Source

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());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download