Jun14

Custom SharePoint display item pages per content type

 Categories:

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 create views.

Views created in the content type colders 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. The web part is filtered by the ID Parameter from the URL and has the following code in the row view template

    <xsl:template name="dvt_1.rowview">

        <tr>

            <td>

                <xsl:variable name="urlprefix" select="substring-before(@URL, ', ')" />

                <xsl:variable name="urlpostfix" select="substring-after(@URL, ', ')" />    

                <script language="javascript">document.title="<xsl:value-of select='@Title'/>"</script> <iframe name="I1" id="I1{generate-id()}" class="MyFrame" width="100%" frameborder="0" src="{substring-before(@URL, ', ')}">Your browser does not support inline frames or is currently configured not to display inline frames.

                    </iframe>

            </td>

        </tr>

    </xsl:template>

 
 

Links to this post

Welcome to the Hotel...

Trackback from Woody Windischman - The Sanity Point on 25 Oct 2008 12:31

Comments

Leave a comment





CAPTCHA Image Validation