Friday, April 16, 2010

Place search text in search bar

Wonder how to write "Search me" in the search area?

Answer: locate search content place holder, "PlaceHolderSearchArea", set the Visible attribute to false, and add a custom one, where the QueryPromptString attribute can be defined.

<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server" Visible="false">

<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox">
</SharePoint:DelegateControl>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder id="PlaceHolderSearchArea1" runat="server">
<SPSWC:SearchBoxEx runat="server" TitleLocIdNum="0"
GoImageActiveUrlRTL="/_layouts/images/goRTL.gif"
UseSiteDefaults="True" TitleLocId="Null" TextBeforeTextBox=""
ScopeDisplayGroupName="" AdvancedSearchPageURL="" DescriptionLocIdNum="0"
AppQueryTerms="" RegisterStyles="True" QueryPromptString="Search the Intranet"
GoImageActiveUrl="/_layouts/images/gosearch.gif"
SuppressWebPartChrome="False" GoImageUrlRTL="/_layouts/images/goRTL.gif"
ShouldTakeFocusIfEmpty="False" GoImageUrl="/_layouts/images/gosearch.gif"
DescriptionLocId="Null" DropDownModeEx="HideScopeDD"
AppQueryTermsLabel="" ChromeType="None" ShowAdvancedSearch="True"
TextBeforeDropDown="" ExportMode="All"
SearchResultPageURL="/_layouts/OSSSearchResults.aspx"
FrameType="None" __WebPartId="{0C712695-C5F8-4162-A555-8B87734BEB7E}">
</SPSWC:searchboxex></asp:ContentPlaceHolder>


also, add this to the masterpage header
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

http://social.technet.microsoft.com/Forums/en-US/sharepointsearch/thread/51487c14-3002-423c-96fe-848a10a14611

No comments:

Post a Comment