How do I direct an Action to a view within a folder?

1

In my Controller UGController I have an Action named Cadastro that takes me to the View Cadastro.cshtml that is in the UG folder.

That is:

Controller: UGController
Action: Cadastro()
Link: /UG/Cadastro
View: /UG/Cadastro.cshtml

So normal. But I would like to create a folder inside View UG to put another file

Controller: UGController
Action: ?
Link: /UG/PDF/Lista
View: /UG/PDF/Lista.cshtml

Doubt: How do I get Action to bring me to the List.cshtml with the link I've described?

    
asked by anonymous 22.07.2014 / 16:38

2 answers

1

Use:

return View("caminho/para/sua/pasta/NomeDaView");

For example:

Controller: MyController
Action: MyAction
Link: MyController/MyAction
View: Views/MyController/PastaQualquer/MyAction


public ActionResult MyAction()
{
   return View("PastaQualquer/MyAction")
}

If you do not resolve to return View("") , you will have to create a new route.

    
22.07.2014 / 16:43
0

For your case it would be:

return View("UG/PDF/Lista");
    
22.07.2014 / 16:47