Thursday, July 12, 2012

SharePoint 2010 - Implementing Search in a List (No Code)

This article has also been published at the NothingButSharePoint.

Description: This tutorial explains how to implement search functionality in a list without any code.

I recently had a requirement of implementing a search page for a List where user pass a search phrase via Query String (e.g. http://SharePoint2010:1000/Pages/Search.aspx?q=hello) and the search page will display the results from a List, based on that search phrase. I am excited to share the technique where one don't have to write a code to develop such page and everything can be taken care of easily via SharePoint Designer.



This technique can also be used in SharePoint 2007 via SharePoint Designer 2007. However the Data View web part's options are available on Data View context menu instead of the tool bar.



Here is the Page's code with text field and button to pass the search string to the Search.aspx page.
<script type="text/javascript">
function Redirect()
{
    window.location = "http://SharePoint2010:1000/Pages/Search.aspx?q=" + document.getElementById('Text1').value;
}
</script>

<input name="Text1" type="text">
<button name="Abutton1" onclick="Redirect();">button</button>

Publiahing Sites vs Communication Sites

It was announced in SharePoint Virtual Summit in May 2017, a more modern way of content publishing is released called Communication Sites. ...