Problem using a PageDataCollection as DataSource to PageSearch

Vote:
 
I have an advanced search page with lots of different ways to search for information. Basically, I want to search for pages with a specific search query string combined with a property criteria search. Since the property criteria search: Global.EPDataFactory.FindPagesWithCriteria(PageReference, PropertyCriteriaCollection) can only start it's search from a specific PageRef, while the PageSearch can start the search from a PageDataCollection, I need to do the property search first. The normal query search alone works just fine. The property search alone works just fine. If I try the query search based on the results of the property search, the result still shows all the property search results. (Note! The code is altered a bit) private bool DoSearch() { // Add criterias PropertyCriteriaCollection pcc = GetCriteriaCollection(); PageReference prCrit = ContainerPage.GetReferenceFromProperty("LibraryContainerPage"); // start point for prop. search // Find pages with criteria and do normal search on result page collection searcher.DataSource = Global.EPDataFactory.FindPagesWithCriteria(prCrit, pcc); searcher.DataBind(); searcher.SearchQuery = SearchQuery; searcher.MaxAllowHits = 1000; searcher.SortOrder = FilterSortOrder.Alphabetical; searcher.Filter += new EPiServer.WebControls.FilterEventHandler(PageIsLibraryResourcePageType); searcher.DataBind(); // Find pages based on query PageDataCollection pdcFinal = searcher.GetPageDataCollection(); ... // Add result to datagrid dgResult.DataSource = pdcFinal; dgResult.DataBind(); } I ws almost positive that it it a databinding problem, but I have tried databinding now in different ways. Why, oh why? The DataSource property of the PageSearch class is not read-only so it seems like it should be possible to do it this way. Help, please.
#12343
Aug 29, 2005 11:34
Vote:
 
Have you tried: {...} searcher.Criterias = pcc; searcher.PageLink = prCrit; {...} Which would get the result in one single search.
#14093
Aug 30, 2005 10:05
Vote:
 
The Criteria property is read-only. Thanks anyway.
#14094
Sep 08, 2005 13:16
Vote:
 
Ah right! But the criteria collection itself isn't read-only so this will do it: {...} foreach (PropertyCriteria pc in pcc) { searcher.Criterias.Add(pc); } searcher.DataBind(); {...} Robert Palmqvist OnTrax AB
#14095
Sep 19, 2005 12:34
Vote:
 
Det har du fullkomligt rätt i! och funkar som det ska gör det också. Tackar!
#14096
Sep 19, 2005 16:46
* 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.