ASP.net MVC Gets Current View

Is it possible to use the current ViewEngineof ControllerContextor ViewEngineCollection? I would like to say the following ViewEngines.GetCurrent. I know that I can make an extension for this method, but I have no idea how to implement this.

+5
source share
1 answer

You can use ViewEngineCollectionto search ViewEnginerelated to a specific view.

ViewEngineResult result = ViewEngines.Engines.FindView(controllerContext,
                                                       "myView","myMaster");
IViewEngine viewEngine = result.ViewEngine;

For more details see info here .

+4
source

All Articles