The Information Worker

October 25, 2006

Showing multiple views of a list using multiple deployments of a web part!

Filed under: SharePoint Technology — adamclark @ 6:48 pm

Overview:

Recently I was asked about creating multiple views (using multiple web parts) to a single list within SharePoint 2003.  Yes SharePoint 2003 is still out there despite the hype around MOSS!

I’m actually sitting on a train writing this so most of this is directly from memory, if I get the names or terms of the items wrong apologies, but the process will be right! Here we go!

Process:

While there are a couple of steps involved in achieving this goal. The logic behind the process is fairly simple as shown in the below diagram:

To create this list and the then connect the web parts use the following process:

1.       Create the list

a.       First up you need to create the list, this can be any list and is as simple as selecting ‘Documents and Settings’, clicking the ‘Create’ button and selecting the type of list that you want! (in the case I was asked about it was a Links list so we’ll use that as an example!

b.      Once we have created our links list we will have a few fields that are created by default including ‘Title, URL & Description’.  For the method I am using to create this multiple Web Part view we are going to need an extra field. To do this click “Modify Documents and Settings” from the action menu on the left hand side of the page and scroll down to the section of the page containing the columns.

c.       Click “Add a new column” to create the new column and enter the following details to configure the column for use!

                                                               i.      Name: Give the column a name: i.e. – “View Select”.

                                                             ii.      Type: Select the Column type, in this case we want to choose the ‘Choice’ option which shows us a drop down list that we can select one value from.

                                                            iii.      Values:  In this example we are creating 3 views to select from so we will need to enter 3 values to select from.  For arguments case lets give the values “Internet, Intranet & Extranet”.

                                                           iv.      These are the only fields that we ‘need’ to enter to create the basic column however you can also further customise the column by entering information into values such as ‘Description’ or ‘ Default Value’.

d.      Click “OK” to create the column in the list.

2.       Create the views

a.       Next we need to create three views that will show us only the information for the value that we select in our ‘ViewSelect’ column.  Scroll down, click ‘Create new view’ and configure the view with the following information:

                                                               i.      Name: Give the view a name, something that represents the value it is going to be configured for, i.e. – ‘Internet’.

                                                             ii.      Filter by:  This field is to filter the information by the ‘ViewSelect’ column value.  To configure this field select the column that is to be used for filtering and enter the value that will be used to set the filtering.  In the case of this filter we will use the value ‘Internet’.

b.      Click ‘OK’ to create the view.

c.       Repeat steps (e.) and (g.) for the next two values ‘Intranet’ and ‘Extranet’

d.       Now when looking at the list you should have four views to choose from:

                                                               i.      All Items: Shows everything in the list

                                                             ii.      Intranet: Shows those links with a ViewSelect value of Intranet

                                                            iii.      Internet: Shows those links with a ViewSelect value of Internet

                                                           iv.      Extranet: Shows those links with a ViewSelect Value of Extranet

3.       Deploy the Web Parts

a.       Next we need to deploy the three web parts that will show the filtered information.  Browse to the page when you want to deploy the web parts and switch to ‘Edit Mode’ and the Add new web part button.

b.      In the Add Web Part list (Select the Browse Option) you will find a web part for your list (in our case ‘Links’)  Drop this web part onto the page three times.

c.       From here we’re home free, we configure each web part to look at a different view of the links list.  Select the first web part and select ‘modify web part’.

                                                               i.      Select the view you want to display (i.e. – Intranet View) and say OK to the information message that appears!

d.      Apply these changes!

e.      Repeat steps (k.) and (l.) for the remaining web parts selecting the ‘Internet’ and ‘Extranet’ views accordingly.

You should now have three web parts deployed showing different information from the one list!

Advertisements

1 Comment »

  1. Adam – any idea how to filter One view to display multiple values instead of using multiple views? ie – use one View to display two of the three values (internet & intranet, but not extranet) based on the user’s profile. I have a web part implementing IFilterProvider and I can filter a view successfully when passing only one value at a time:
    Ex – FilterField1=ViewSelect&FilterValue1=Internet
    The above filter works as expected. However, when I want to filter with multiple values (again – in only One view), the below does NOT work:
    FilterField1=ViewSelect&FilterValue1=Internet&FilterField2=ViewSelect&FilterValue2=Intranet

    When I pass this filter to a View, nothing shows up. Is there a way to introduce an Or logic into a view filter? Any ideas? Thanks.
    tf

    Comment by tf — December 2, 2006 @ 6:31 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: