I'm using the following to render a dynamic list of services:
@{
if (Model.Content.HasValue("checkBoxServices"))
{
foreach (var item in Model.Content.GetPropertyValue<string>("checkBoxServices").Split(','))
{
Html.RenderPartial("practiceServices"/@item);
}
}
}
The idea is that each partial will contain information on one service.
It works perfectly if the partial is in the root partial directory, but there are going to be a lot of items and I want to keep them in their own "practiceServices" folder.
However... this is throwing an error and I'm not sure why.
Can anyone suggest a solution?
ie by giving direct path to the razor file it should work! - when the direct path isn't specified, MVC will look in the folders it 'knows' the file might reside in, eg the Partials root folder.
Rendering a dynamic Partial View?
Hi all,
I'm using the following to render a dynamic list of services:
The idea is that each partial will contain information on one service. It works perfectly if the partial is in the root partial directory, but there are going to be a lot of items and I want to keep them in their own "practiceServices" folder. However... this is throwing an error and I'm not sure why. Can anyone suggest a solution?
Hi Colm
Try:
ie by giving direct path to the razor file it should work! - when the direct path isn't specified, MVC will look in the folders it 'knows' the file might reside in, eg the Partials root folder.
regards
Marc
Thanks Marc,
That did the trick!
On a similar note.. could you explain why this isn't working?
Thanks,
Colm
is working on a reply...