Monday, June 1, 2009

Custom SharePoint display item pages per content type

[Updated with more detail] My list of over 1,800 SharePoint resources uses content types to distinguish the metadata that is relevant to each type of resource (article, blog, download etc.)

If the content type is KB Article, I wanted the default display item page to be customised to render the Microsoft KB Article page in an iFrame within the list item page.
A list with content type management enabled has a folder per content in which you can place views. This helps organize all the content type specific forms (Display item, New item and Edit item) into folders.

Views created in the content type folders are not shown in the default list views drop-down

You can then specify the default item view per content type by right-clicking on the list folder in SharePoint Designer and select properties to set the supporting files value for the Display item form

Even though a url might link to the default page e.g. http://www.wssdemo.com/Lists/Resources/DispForm.aspx?ID=1534
it will redirect to the custom page automatically (try it...)

My custom view page uses a Data Form web part to display a single item.

To create this in SPD, just right click on the List name and select New/List View Page.

Edit the new view, delete the List View web part and insert a Data Form as a "Single Item View" of the list
Insert Data View

Select the list item for which you are creating the view and select "Show Data" from the drop down
Data View Single Item

The web part is filtered by the ID Parameter that will be included on the URL.

Create the Parameter from the Data View properties
Data View Parameter

Then create a filter for the Data View
Data View Filter

and substituted the row view template code withing the DAta View web part for this...

You can include this CSS style in the page to resize the iFrame height to match the current browser height (- sharepoint chrome height).



Refrence::http://www.wssdemo.com/Blog/default.aspx

No comments: