Need to hide a list view web part when list is empty

May 26, 2010 at 5:22 PM

Can I use this Visibility Filter web part to hide a list view web part when the list is empty?  If so, how?
When a list is empty, SharePoint shows a view with the column header and a default message, and I don't want the users to see that default empty list message: "There are no items to show in this view of the [ListName] list.  To create a new item, click 'New Item' above."

May 26, 2010 at 9:20 PM

If all you are looking to do is change or eliminate that message, the way to do that is to open the site with SharePoint Designer, then right-click on the list view web part and use the option "Convert to XSLT Data View".

This converts your standard list view web part to a Data View Web Part (aka Data Form Web Part aka XSLT Data View).

Then use the action menu on that web part (the > button at the upper right of the web part) and choose Data View Properties.  There is a field you can change labeled "Display text if no matching items are found".

As for using the Visibility Filter to hide the whole thing when no data is available - I have not tried this but try connecting it to the list view web part and use Connection as the data source, with the condition set to use field "ID" where "not matches" the value "[0-9]".  The ID will always be a number.  But off the top of my head, I don't know what it will do when there is no data.