Recently I was given a task to enable Search Bar in Search result page of SharePoint. If you meet such requirement here is the simple solution:
Case 1: You have not configured search service:
In this case your search will open SharePoint default result page: osssearchresults.aspx.
You can find this page in "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS".
Open this page and in "PlaceHolderSearchArea" ContentPlaceHolder add below lines of code:
<div id="searchInputBox">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" />
</div>
save the file.
Refresh your search page and you will see the search bar in header section.
Case 2: You have configured Search service:
In this case your search will open pages/result.aspx page for search result.
But we can't add our code in this page. We need to add our block of code in the page layout of this page.
You can find that in "Site settings->masterpages & page layouts -> SearchResult.aspx"
Download this page.
Open this page and in "PlaceHolderSearchArea" ContentPlaceHolder add below lines of code:
<div id="searchInputBox">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" />
</div>
save the file.
If you refresh your page and you get error "Sorry, Something went wrong", Please check this blog.
Subscribe to:
Post Comments (Atom)
-
In last blog we learn how can we enable footer on SharePoint Online Modern Communication site. If you have not gone through that you can use...
-
One of our client wanted to show Employee Directory and our first suggestion was to build custom SPFx which will fetch data from Azure AD or...
-
Recently I was working on sending mail using smtp server where I stuck on below error: IIS/SMTP - emails are stuck in mailroot/Queue ...
No comments:
Post a Comment