London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

PropertyCriteria on ParentLink not working?

Vote:
 

                PageDataCollection oPages;
                PageReference oParent = PageReference.StartPage;

                //Filter on the right
                PropertyCriteriaCollection criterias = new PropertyCriteriaCollection();

                PropertyCriteria criteria = new PropertyCriteria();
                criteria.Type = PropertyDataType.Number;
                criteria.Name = "ParentLink";
                criteria.Condition = CompareCondition.Contained;
                criteria.Value = "27";
                criteria.Required = true;

                criterias.Add(criteria);
                

                oPages = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage,criterias);

 

I try to retrieve the pages from my root with Criteria Filter (yes i know i can use the getchildren, but want also use another Criteria).

Can someone tell me what i am doing wrong?

#36214
Jan 19, 2010 14:49
Vote:
 

Hi

All built in properties are prefixed with "Page". So try changing to:

criteria.Name = "PageParentLink";

Does that make any difference?

Regards

Per Gunsarfs
EPiServer development team

#36218
Jan 19, 2010 15:04
Vote:
 

Hi Per, when i try that i get an error: "No compare condition is defined."

Any idea what can be wrong?

 

Ok, when i use this, i still got no results...

 

                PageDataCollection oPages;
                PageReference oParent = PageReference.StartPage;

                //Filter on the right
                PropertyCriteriaCollection criterias = new PropertyCriteriaCollection();

                PropertyCriteria criteria = new PropertyCriteria();
                criteria.Type = PropertyDataType.Number;
                criteria.Name = "PageParentLink";
                criteria.Condition = CompareCondition.Equal;
                criteria.Value = "27";
                criteria.Required = true;

                criterias.Add(criteria);
                oPages = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criterias);
                //Bind Datasource to Control
                MainNavRPT.DataSource = oPages;
                MainNavRPT.DataBind();

#36220
Edited, Jan 19, 2010 15:12
Vote:
 

Ah, sorry CompareCondition.Contained should be: CompareCondition.Equal , changed that for debugging reasons ;)

#36221
Jan 19, 2010 15:15
Vote:
 

Ok, had to change criteria type to PageReference, it's working now:

criteria.Type = PropertyDataType.PageReference;

#36222
Jan 19, 2010 15:24
* 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.