Monday, February 15, 2010

"Search For" function SSRS Report Manager.

Unfortunately Microsoft in their wisdom decided that the search box should not be removable easily. It is possible with a little javascript and editing of a few aspx pages.

First we hide the label for the search box. This is easy enough as it is stored in the css file.

  1. Open ReportingServices.css - (C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\Styles)
  2. Replace the Label of search box with the css below (basically I am just adding the "display: none" to it)

    /* Label of search box*/
    .msrs-search {
    font-family: Verdana, serif;
    font-size: x-small;
    color: black;
    font-weight: normal;
    text-decoration: none;
    display:
    none;
    }
  3. Use JavaScript to hide the Search textbox and button;

    a. Browse to the folder
    C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\Pages (SQL 2008)

    b. Create a new file using notepad (text file)


    function HideSearchPanel()
    {
    var txtSearch= document.getElementById('ui_txtSearch');
    var btnGo= document.getElementById('ui_btnGo');
    if(txtSearch && btnGo)
    {
    txtSearch.style.display = "none";
    btnGo.style.display =
    "none";
    timer=setTimeout(HideSearchPanel,1);
    }
    }
    var timer;
    timer=setTimeout(HideSearchPanel,1);


    c. Save the file with filename HideSearchPanel.js (include the extension name .js)
    d. Now, open the Folder.aspx with notepad, add the following code to this page, and then save this file:



    e. Repeat step ( d ) in other pages such as Report.aspx, DataSource.aspx

    That should do it!

No comments: