Lamont Harrington's Blog

Microsoft Solutions Development, Architecture, and Technology Evangelism

I was recently contacted through my blog with a question on how to dynamically hide/show a web part on a web part page based on a user's selection of a UI element on the page.  While there's several methods you could employ to perform this task, one nice, neat implementation that you could leverage is posted up on our CodePlex site called the SharePoint Web Part Visibility Filter Web Part.

Through the implementation of this web part, you have the ability to accomplish the following scenario:

You have a standard SharePoint list containing a listing of items that offer selection options and a 'Item Detail' part, which happens to be an implementation of the Visibility Filter Part, that will show detail information based on the user selection from the list above it.

In the screenshot below, upon making a different selection from the list of items, a new details web part is now displayed showing details for the selected item.

Now this implementation is built upon concepts that have been around SharePoint for quite some time, like connected web parts, however, this is a decent implementation that addresses the requirement for being able to dynamically hide and show web parts based on some dynamic criteria.

Head over to CodePlex and take a look at this project.  Pretty interesting!

A few caveats to keep in mind (taken from the notes on the project's CodePlex page):

  • The web part needs to render itself before the web part(s) that may be affected by it (hidden or unhidden), so you need to place it in a web part zone above the potentially affected web parts.  Web parts are rendered in order of their zone indexes, and then their index within each zone.  If a web part is rendered before the Visibility Filter Web Part that affects it, its visibility will not appear to have changed because it was already rendered.  In other words, your Visibility Filter web parts should probably be placed at the top of your page, before all other web parts.
  • This web part does not actually generate any visible HTML output to the page (it affects other web parts) but can emit Javascript to the page. By default, when it is placed on a page, its visibility is automatically set to Hidden. The Javascript it generates is to modify the titles of web parts that it is unhiding (if any). SharePoint adds the string "(Hidden)" to any web parts that are initially hidden and that remains even if this web part unhides them, so it generates Javascript to find the titles of those unhidden web parts and removes the "(Hidden)" string from their title.
  • You may need to include multiple instances of this web part on a page to selectively hide/unhide web parts.
  • Although this web part can dynamically hide other web parts, those web parts will still internally "render". They are hidden using the SharePoint web part API (not via CSS or Javascript on the page) so the data from the web part will not be generated on the page at all, but SharePoint will still "execute" the web part code, so hiding it will not reduce any significant load on the server. In other words, if you have a web part such as a Data View Web Part that queries a SQL database, it will still query the database even if this web part hides it, although the result of the rendering will not be output to the browser. That is to say, if you have 10 web parts on a page and this web part hides 5 of them, except for the time it takes to load the page in the browser, the page will not render much faster because those 5 web parts are hidden. From the server side, it would be as if all 10 web parts were still on the page.

 Enjoy!




The Azure Issue Tracker application is a sample application that allows users to capture and track various types of issues. This sample demonstrates a real-world SaaS architecture and scenario using the Azure Services Platform to perform federation and multi-tenancy. Technologies used include the Access Control service (part of .NET Services) as well as SQL Data Services (part of SQL Services).

This sample is being released in two versions: Standard and Enterprise. The Standard version allows ad-hoc users to use LiveID federation with the .NET Access Control Service and authorize other LiveID users. The Enterprise version of IssueTracker wile use the same claims-based authorization capabilities as the standard version, but allow greater control by customers over claims and authorization decisions.

To learn more about this great sample application and download the source code, head over to the Azure Issue Tracker CodePlex project website.




Last week, we officially launched the beta release of the Microsoft Web Platform, which includes the Microsoft Web Platform Installer (WebPI), and the Microsoft Web Application Installer (WebAI).

  • The "Web Platform Installer" is a download manager that drastrically simplifies the download process and installation of the Microsoft Web Platform.
  • The "Web Application Installer" enables the installation of several popular Open Source applications to run on top of Windows.

The installers are available for download from www.microsoft.com/web.

Microsoft.com/Web Web Platform Installer Beta Web Application Installer Beta

Provides a single destination where developers can learn about the collection of tools, servers and technologies that make up the Microsoft Web Platform.

Aggregates top articles from popular media resources, events, web specific video tutorials and links to products that make up the Microsoft Web Platform. Provides a destination for web professionals to learn about the web with content tailored to their profession.

The Microsoft Web Platform Installer Beta (Web PI) simplifies the setup and acquisition of the products that make up the Microsoft Web Platform. A single install gets you the software you need to build and run a complete web solution on the Microsoft stack.

The Microsoft Web Platform Installer Beta is a free tool that makes it simple to download and install the latest components of the Microsoft Web Platform, including IIS7, SQL Server Express, .NET Framework and Visual Web Developer.

To help you stay up-to-date with product releases, the Web Platform Installer Beta always contains the most current versions and new additions to the Microsoft Web Platform.

The Microsoft Web Application Installer Beta (Web AI) provides easy access to popular community PHP and .NET web applications for Windows Server. Supported applications include: DotNetNuke, Drupal, Gallery, Graffiti, osCommerce, PHPBB, and WordPress.

The Microsoft Web Application Installer Beta downloads, installs and configures top ASP.NET and PHP community Web applications to run on your Windows Server.

The Microsoft Web Application Installer Beta handles all the detail work for you, including configuring IIS 7, ensuring your computer has the required prerequisites, and managing where to download the application




Calendar

<<  August 2010  >>
MoTuWeThFrSaSu
2627282930311
2345678
9101112131415
16171819202122
23242526272829
303112345

View posts in large calendar

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009, Lamont Harrington.