How to hide and show webpart

Posted on 2009-12-17
Last Modified: 2012-05-08
I want to hide and show the search core results webpart based on the scope user choose in the Advanced Search page.
For example in the Advanced Search page I have multiple scopes
1) Scope1
2) Scope2
3) Scope3

When user choose Scope1 then the searchcore reullts1 webpart should show and hide the two other search core results webparts. How is it possible.

Question by:vmandem
    LVL 15

    Assisted Solution

    As I understand you would like to hide specific web parts depending on the scope passed in the URL of the search, right?
    If so you can do it 2 ways - either code it (for ex create a web part that will read the query string and will hide the selected web parts, or use a javascript to check the URL, find the scope and use the style.display='none' for the selected web parts
    LVL 11

    Accepted Solution

    Load your page in browser and then view source. You will find how SharePoint renders the page into HTML, such as the tags it generates for each web parts, etc. Then you just need to add javascripts into your page to hide and show the web parts.
    LVL 15

    Expert Comment

    One remark to thman comment - web part ID's are generated dynamicaly and can change when you for example change layout, web part order or even save the page, so you might brake your solution by simply moving the web part.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Pimping Sharepoint 2007 without Server-Side Code Part 1 One of my biggest frustrations with Sharepoint 2007 in the corporate world is that while good-intentioned managers lock down the more interesting capabilities of Sharepoint programming in…
    SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now