Question

I need to create a sharepoint page that will show the data from diferrent SharePoint list in a single view based on user selection. If the user want to view info about Employee the Page will display data from employee List. If they want to view the Students info it will show data from Students List.

I want to have one list webpart(XSLT List View webpart???) and change the content based on user selection. The List to use will be passed to this page via a Query String...

Any Suggestions?

Was it helpful?

Solution

You could use the SPDataSource Control in combination with the BaseXsltListWebPart the achieve this.

Try the following:

  • Create a Control which includes the SPDataSource control. You can find a description how to use the SPDataSource control in Chris O'Brien's Blog. In the second post you can find a description how to use the Query String as parameter
  • Create a WebPart which inherit from the BaseXsltListWebPart
  • In the OnInit add your DataSource control to the Controls collection of the WebPart and assign it the a field
  • Overwrite the GetDataSource method and return your control
  • Set your XSL with the Xsl or the XslLink property

OTHER TIPS

The simplest way is by using the Filter web parts (require SharePoint standard license at least). These web parts come in many "shapes", see here examples and details how it can be used http://office.microsoft.com/en-us/sharepoint-server-help/work-with-filter-web-parts-HA010033786.aspx#BM2

These web parts are Connectable web parts which actually consume/provide data to each other and one could achieve this via the web UI.

Hope it helps, C:\Marius

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top