Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I was pushed to replace the default search box in a site collection with a customized one. At the moment it looks like this:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Control
Id="SmallSearchInputBox"
Sequence="23"
ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" ControlAssembly="Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<!--Advanced Search Link-->
<Property Name="ShowAdvancedSearch">true</Property>
<Property Name="AdvancedSearchPageURL">_layouts/xyz/SupplierPhonebook/AdvancedSearch.aspx</Property>
<!--Search Options-->
<Property Name="SearchResultPageURL">_layouts/xyz/SupplierPhonebook/AdvancedSearch.aspx</Property>
<Property Name="QueryPromptString">Nach Ansprechpartner suchen...</Property>
<Property Name="UseSiteDefaults">true</Property>
<Property Name="ScopeDisplayGroupName"></Property>
<!--Layout Options-->
<Property Name="SearchBoxTableClass">search-box</Property>
<Property Name="GoImageUrl">/_layouts/images/gosearch15.png</Property>
<Property Name="GoImageUrlRTL">/_layouts/images/gosearchrtl15.png</Property>
<Property Name="GoImageActiveUrl">/_layouts/images/gosearchhover15.png</Property>
<Property Name="GoImageActiveUrlRTL">/_layouts/images/gosearchrtlhover15.png</Property>
<Property Name="DropDownMode">HideScopeDD</Property>
<Property Name="FrameType">None</Property>
</Control>
</Elements>

By default it works, but only at the default page of the site collection. So when I first enter a other page, list, application page etc. pp the link is wrong.

Than it looks like this:

http://sp2010:10000/phonebook/phonebook/_catalogs/masterpage/_layouts/xyz/SupplierPhonebook/AdvancedSearch.aspx

or like this when I'm performing a search

http://sp2010:10000/phonebook/_layouts/xyz/SupplierPhonebook/_layouts/xyz/SupplierPhonebook/AdvancedSearch.aspx?k=Test

I have tried mostly all url tokens (~Site, ~SiteCollection, ~site.. etc.) Nothing works. I can't implement a fixed url cause the application will be tested on serveral servers with different urls.

So what I need is to know how I could redirect the AdvancedSearchPageURL and SearchResultPageURL allways to a page like this: http://{SERVER}:{PORT}/{SITECOLLECTION}/_layouts/xyz/SupplierPhonebook/AdvancedSearch.aspx

The problem with the url tokens is, that they dont get translated :\

Thx alot

Best Regards

Jan

share|improve this question
add comment

1 Answer

I think those URL's have to be sitecollection relative. So if _layouts or /_layouts does not give the right result, I would try the following...

If you set the 'UseSiteDefaults' property of SearchBoxEx control to 'True' it will then take the configured values of the site. Site Actions > Site Settings > Search Settings. Maybe that will make a difference.

The following method will work 100%: if you inherit from the SearchBoxEx control - you can set the this.AdvancedSearchPageURL = SPContext.Current.Site.Url + "/_layouts....";

Hope that helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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