I recently realized that the SharePoint Data View Web Part framework provided a means to expose standard ASP.NET data sources. This means that anything that can be exposed using a Data View Web Part can also be utilized in an ASP.NET data bound control: Lists, Document Libraries, Databases, RSS feeds, Web Services, etc. This is pretty powerful! In the following screencast, I will show you how you can create a filtered view of a Document Library; the filter is applied using a standard ASP.NET drop-down list, which is bound to a SharePoint Data Source (in this case, exposing a List).

There is no particular trick involved. All you need to do is go to one of your Data View Data Sources, and select the "Insert Data Source" option. You can then insert any ASP.NET control and bind it to this data source. You can use all of the usual properties, typically in this example, I will set the drop-down list's AutoPostBack property to true, so that the page is automatically refreshed when I select one of the items.

Another key point is of course how to pass the selected value on to a Data View: you cannot use Web Part connections, since the source control is not a Web Part. But the Data View allows you to define custom input parameters, and the source of such a parameter can be a Control, which is how we connect our drop-down list to the Data View filter.

This technique allows you to build seriously complex interfaces without a single line of code!

Here's the embedded Flash version of the screencast. You can also download the full WMV version (27 MB).