Is there any easier way to do this, can someone point me in the right direction.
I have a number of case histories items that have a value (eg "Car Park") via a drop down menu "Catagory". I display all the items on a page (Case Histories) but also have a page for each item (ie Car Park) and wish to display just the items that relate to that page.
I can do this by creating a document type for each page ie "Case History Car Park" and adding the razor.
var casesort = Model.Content.Site().FirstChild("caseHistoryPage").Children()
.Where(x => x.HasValue("Catagory") && x.GetPropertyValue<string>("Catagory").Equals("Car Park"));
Is there a way that I can use the Document type "Case history" for all pages or do I have to create a Document type for each (Car Park, Maintenance, Painting etc)
When the client adds a new case history they have a drop down menu to choose the catagory of the Case history.
All the Case histories are displayed on the Case History page but I also wish to display just the case histories that relate to the page under services. ie the page /Services/Car Park Upgrades to display the items that just have the catagory "Car Park". The page /Services/Painting to display the items that just have the catagory "painting".
Easier way to display page .HasValue
Is there any easier way to do this, can someone point me in the right direction.
I have a number of case histories items that have a value (eg "Car Park") via a drop down menu "Catagory". I display all the items on a page (Case Histories) but also have a page for each item (ie Car Park) and wish to display just the items that relate to that page.
I can do this by creating a document type for each page ie "Case History Car Park" and adding the razor.
Is there a way that I can use the Document type "Case history" for all pages or do I have to create a Document type for each (Car Park, Maintenance, Painting etc)
First of all
Model.Content
has been changed to "just"Model
in v8I don't think I understand your question right, but would't you just want to add the "Car park" as a value from the page you are on?
something like:
Thanks Soren. Let me try an explain further.
I have a number of case histories
When the client adds a new case history they have a drop down menu to choose the catagory of the Case history.
All the Case histories are displayed on the Case History page but I also wish to display just the case histories that relate to the page under services. ie the page /Services/Car Park Upgrades to display the items that just have the catagory "Car Park". The page /Services/Painting to display the items that just have the catagory "painting".
Does that help?
Again, you just needs use a property from the page you are on, to filter the list of related page, like in the code i posted
Thanks Soren
I am new to Umbraco so please bear with me. I tried your code and it returned
CS1929: 'RenderModel
is working on a reply...