I have an MVC Application broken down into multiple areas. The structure is like this: Areas > AreaName > Views > various view folders
I need to add a folder inside these view folders called HelpFiles making the structure like this Areas > AreaName > Views > various view folders > HelpFiles
In my Layout page, I have an icon when its clicked, it will call a controller method that will return all partial views inside the HelpFiles folder and display them inside a div.
What I have done so far: I have added a method to the basecontroller like this:
public ActionResult ShowHelpText(string viewName)
{
var areaName = ControllerContext.RouteData.DataTokens["area"];
var folderName = "~"+ areaName + viewName + "HelpFiles/";
ViewBag.Partials = ????
return View();
}
On the returning view my code is like this:
@foreach (string partial in ViewBag.Partials)
{
//Html.RenderPartial(partial);
@Html.Partial(partial)
}
My problem is I am not able to figure a way to get all the views from a folder.
I realize this is not the ideal way of doing this, the help text should come from a database etc, however due to a CMS service tie in, we are stuck with this structure for now.
Any help or pointers will be much appreciated.
Thanks