we created a custom SeachCenter WebTemplate in VS and added several webparts through the onet.xml. We added some default webparts (e.g. SearchBoxEx) and some custom webparts which inherit from CoreResultsWebpart.

Inside the codebehind I need to access the results, so I tried to get the QueryManager-object by the following Code (simplified representation):

QueryManager queryManager = SharedQueryManager.GetInstance(Page, QueryNumber).QueryManager;
if(queryManager.Count > 0)
    LocationList locationList = queryManager[i];
    XmlDocument resultsDoc = queryManager.GetResults(locationList);
    //Do stuff...

My Problem is, that the count of the Query Manager is 0. For other custom Webparts on this page the QueryManager returns multiple LocationLists in the same postback.

All WebParts on the Resultspage have the same QueryNumber / QueryId.

Do you have any idea why i got a empty QueryManager? Could it be a timing problem?

I'd appreciate some advice :)


Remember to copy the xslt from the original web part as the default xslt coming with a new CoreResultWebPart is for internal SharePoint search, and will not render anything.


I found out that i simply have to call


After this call the SharedQueryManager is correctly initialized. Thanks for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.