Hiding items that returns false in one or more properties
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
var Brand = @Request.Params["brand"];
var Price = @Request.Params["price"];
}
@foreach(var item in CurrentPage.Children){
<p>@item.Name<br />
//The following outputs True or False depending on values defined in my address bar.
//(Just to see what is happening)
@item.brand.Contains("" + Brand + "")<br />
@item.pris.Contains("" + Price + "")
</p>
}
In the code above I only want to show the item if all values are True. If one or more values returns False, the item should not be shown.
I have tried to make an if-sentence inside my foreach, using GetPropertyValue, but haven't got it to work.
Can anyone give me some pointers on how to assemble this correct?
Hiding items that returns false in one or more properties
In the code above I only want to show the item if all values are True. If one or more values returns False, the item should not be shown. I have tried to make an if-sentence inside my foreach, using GetPropertyValue, but haven't got it to work.
Can anyone give me some pointers on how to assemble this correct?
Hi Soren,
Have a look at the following post. It might help you to get this working.
http://our.umbraco.org/documentation/Reference/Mvc/querying
For properties
http://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors
//Fuji
Hi Soren,
How about something like this?
Jeavon
Thanks for the inputs guys!
is working on a reply...