November Happy Hour will be moved to Thursday December 5th.

Using PropertyCriteria with Category

Vote:
 
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:
 
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:
 
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:
 
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:
 
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.