PropertyCriteria

Vote:
 
Can anyone help me please. I have 6 pages of the "type" disply article (displayes headline, abstract and ful lstory text). One of these pages has the attribute VisibleInMenu set to false (do not show in menu). I want to retrieve the page that has the attribute VisibleInMenu set to FALSE by using PropertyCriteria. But I get 0 results by doing this. Why? Here is my code: PropertyCriteriaCollection criterias = new PropertyCriteriaCollection(); PropertyCriteria criteria = new PropertyCriteria(); criteria.Condition = CompareCondition.Equal; criteria.Type = PropertyDataType.Category; criteria.Value = "false"; criteria.Name = "VisibleInMenu"; criteria.Required = true; criterias.Add(criteria); PageDataCollection ChildPages = EPiServer.Global.EPDataFactory.FindPagesWithCriteria(CurrentPage.PageLink, criterias); SideInfo.PageLink = ChildPages[0].PageLink; I've also tested setting Value to "true".
#12967
Mar 15, 2007 10:44
Vote:
 
Steven, Not all of the 'built-in' properties have names that match what you see in the Editor. Look at PageData.Property in the SDK. In your code sample you need to change criteria.Name to be "PageVisibleInMenu", and criteria.Type to PropertyDataType.Boolean - it should work then, I think. /Mark
#15179
Mar 15, 2007 18:05
Vote:
 
I'm not sure if it will work, but because it is one of the built in properties, and is not saved in the tblProperty table, it might. You will have to try. But - for custom properties, searching for a "false" value for a PropertyType.Boolean will not work. The reason is that "false" values are not saved into the database - to preserve space I guess. So, the fact that it does not exist imply that it is false, but you cannot search for values that do not exist :-) This is why you cannot "undo" a Dynamic Property setting if is a bool. You can always set it to true on one page, but you cannot set any children of that one to false, and make it stick. And yes, I agree, this is not one of the more intuitive features in EPiServer :-) /Steve
#15180
Mar 15, 2007 19:38
Vote:
 

If anyone is wondering it does work.

 

var criteria = new PropertyCriteria(){
    Condition = CompareCondition.Equal,
    Value = "false",
    Type = PropertyDataType.Boolean,
    Required = true,
    Name = "PageVisibleInMenu"
};

    

#56932
Edited, Feb 16, 2012 14:36
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.