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!

Using PropertyCriteria with Category

Vote:
0
Im trying to use PropertyCriteria with FindPagesWithCriteria() and would like to filter on a category. Is this possible? And how do i do this? This does not work: Criteria = new PropertyCriteria(); Criteria.Name = "Category"; Criteria.Required = true; Criteria.StringCondition = StringCompareMethod.Contained; Criteria.Type = PropertyDataType.Category; Criteria.Value = Category.Find("region").ID.ToString(); Regards Peter
#12230
Mar 04, 2005 10:16
Vote:
0
You have to use "PageCategory" as criteria name, not "Category". Also see the following posting for more info: http://www.episerver.com/templates/ForumItem____1967.aspx Frank :)
#13885
Mar 06, 2005 19:27
Vote:
0
PropertyCriteria pageProperty = new PropertyCriteria(); pageProperty.Condition = CompareCondition.Equal; pageProperty.Type = PropertyDataType.Category; pageProperty.Value = m_lbCat.SelectedValue.ToString();//CurrentPage.Property["PageCategory"].ToString(); pageProperty.Name = "PageCategory"; criteriaCollection.Add(pageProperty); string msg = "" ; foreach(ListItem li in m_lbCat.Items) { if(li.Selected == true) { msg += "
" + li.Text + " is selected."; } } label1.Text = msg;
#13886
Mar 07, 2005 12:44
Vote:
0
I´ve been trying adding this to PageSearch.Criterias Im getting the following error. Why? Error message: Cannot compare property "PageCategory", doesnt support IComparable(?) PageSearch GlobalList = new PageSearch(); criteria = new PropertyCriteria(); criteria.Name = "PageCategory"; criteria.Required = true; criteria.Condition = CompareCondition.Equal; criteria.Type = PropertyDataType.Category; criteria.Value = "UK,Family"; GlobalList.Criterias.Add(criteria);
#13887
Mar 09, 2005 14:36
Vote:
0
You have to use StringCondition and not Condition. Value should be a comma-separated list of ids or names. PropertyCriteria category = new PropertyCriteria(); category.Name = "PageCategory"; category.Type = PropertyDataType.Category; category.StringCondition = Filters.StringCompareMethod.Identical; category.Value = "Technical"; //comma-separated list of ids or names
#13888
Apr 05, 2005 17:35
* 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.