Modifying the SharePoint 2010 Preview Pane View Style

Out of the box, SharePoint 2010 offers several styles that can be selected when creating a view of a list or library. One really useful style is the Preview Pane. If you have a list with a lot of columns, the Preview Pane style is great for creating a vertical view of the data, avoiding the dreaded horizontal scroll. If you’re not familiar with the Preview Pane, Microsoft has a quick screen cast that shows how to use it.

Unfortunately, out of the box, there’s no way to identify which column should be used in the pick list – that list of items on the left side of the preview pane. It defaults to the title column, and there’s no way in the web-based tools to modify that. So, what happens if for some reason you’re not using the title column in the intended manner? Well, you end up with something like this:

A Not Very Functional Preview Pane View
A Not Very Functional Preview Pane View

Not so great, right? If you Google around for a solution, you’ll find options such as using a workflow to update the title column with the data you want when an item is added or using a CAML editor tool. Hm…. No thanks.

Turns out that you can make it work with a little help from SharePoint Designer. Fire up SharePoint Designer 2010. Load your site. Navigate to your list. In the Views module, click the preview pane view that you created. (If you haven’t created one, watch that screen cast and create one first.)

Click the Preview Pane View to edit it
Click the Preview Pane View to edit it

Now that you’re in edit mode for the Preview Pane style, do any of the typical tweaks you might do on any view – change the sort order, the paging, add or remove columns. Do everything you might want to do using the Ribbon options before we get to this next part. It makes life easier.

Now for the fun stuff.

Find either the title or the words “(no title)” in the left column. Highlight either the title in a row of data or the “(no title)” words. Right click, and select “Edit Formula.”

Highlight the words to replace and select "Edit Formula"
Highlight the words to replace and select "Edit Formula"

A pop-up window will open where you can select another column of data, enter static text, or use any number of formulas to generate the text you want to use. I concatenated two columns.

Using a formula to concatenate columns
Using a formula to concatenate columns

If you have some rows of data with titles and some without, you’ll need to repeat this process for both types of columns.

So, what’s happening behind the scenes is that a new XSLT template is being added to code view. It’s called the “LinkTitleValue.LinkTitle” template, and it determines what data is being used for the link to the item. The template looks like this:

<xsl:template name="LinkTitleValue.LinkTitle" ddwrt:dvt_mode="body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:param name="thisNode" select="."/>
<xsl:param name="ShowAccessibleIcon" select="0"/>
<xsl:variable name="titlevalue" select="$thisNode/@Title"/>
<xsl:when test="$titlevalue=''">
<xsl:value-of select="concat($thisNode/@Chapter_x0020_Name, ' - ', $thisNode/@EIN)"/>
<xsl:when test="$HasTitleField">
<xsl:value-of select="concat($thisNode/@Chapter_x0020_Name, ' - ', $thisNode/@EIN)" />
<xsl:value-of select="$titlevalue" />
<xsl:when test="$ShowAccessibleIcon">
<img src="/_layouts/images/blank.gif" class="ms-hidden" border="0" width="1" height="1" alt="{$idPresEnabled}" />

Save your file and test it. Looks great, right?

Title Successfully Replaced
Title Successfully Replaced

You have now successfully replaced your title with your preferred information and it’s linked to the item. It also has an ECB menu attached to the item.

What happens if we use the ECB menu to view or edit the item? Oops! The Javascript gets confused and it drops out the text we just spent our time putting in there!

Oops! Where'd our text go?
Oops! Where'd our text go?

I haven’t dug into why this is happening, and I’m sure someone else will do that. (Leave a comment if you figure it out!) But, I do have a workaround. One more step. I find this step easier to do back in the browser. So, save and close SharePoint Designer. Fire up notepad and type the following:

<style type="text/css">

.s4-ctx {


Save it as a text file and upload it to your site. Make note of the location. (Right click and “copy shortcut.”) (I used the “site assets” library.)

Navigate to your view. Select Site Actions -> Edit Page. Add a Content Editor Web Part and edit the web part to add a Content Link. Paste the shortcut and click “Ok.”

Link to your text file from the content editor webpart.
Link to your text file from the content editor webpart.

Save your file. Your “title” pane will now have the data you want, minus the ECB menu. Hovering over the item will load it in the preview pane. Clicking it will load the pop-up window for viewing or editing the content. One caveat, and Microsoft insists it’s a “feature – not a bug,” is that you’ve now lost your view menu in the breadcrumbs. (Glyn Clough provides more information about this issue. And Pentalogic has a free solution that fixes the issue on all pages, but may be a bit “nuclear,” as they put it.)

The View Menu disappears on view pages that have been edited.
The View Menu disappears on view pages that have been edited.

The workaround for that is to edit the page in SharePoint Designer to add your custom css. However, this customizes the page. You’ll have to choose whether you’d rather deal with customized pages or an alteration of the the UI. If you want to customize the page and retain the breadcrumbs, remove the Content Editor Webpart and save your page. Fire up SharePoint Designer again. Navigate to your list. Right click on your Preview Pane view and select “Edit File in Advanced Mode.”

Edit File in Advanced Mode
Edit File in Advanced Mode

Note: If you do not have the Edit File in Advanced Mode option, it is because your site collection or farm administrator has restricted the use of SharePoint Designer in your environment.

Once your view loads in advanced mode, switch to code view and search for “PlaceHolderAdditionalPageHead.” Add the CSS we had previously added via the Content Editor Webpart to that tag, like so:

Add CSS Via SharePoint Designer
Add CSS Via SharePoint Designer

Save your file. Voila – you now have customized title pane with no ECB menu and have retained the view selector breadcrumb.

The other major advantage of using this method versus the Content Editor Webpart is that the CSS will render in the head of the page, where it belongs. However, if you do choose to use this approach, make sure you are tracking what pages you are customizing so that when it comes time to upgrade you’ll know which files need to be double-checked.


42 thoughts on “Modifying the SharePoint 2010 Preview Pane View Style

  1. Thank you so much! I tried another code from another Web site and it didn’t help.
    Yours did! Changing the formula, it wouldn’t work; I actually had to replace the code you provided, starting with the . So thank you!

    1. I’m so glad it worked for you. Not sure why changing the formula didn’t work. I also have discovered some funkiness if there are folders in the list – that changes things a bit.

  2. Yeah not sure. So my new problem is that when I go to select my new awesome view into a Web part, it will show it as a view, but doesn’t show the changes I made to the left side, it still shows the contact name. Any ideas??

    1. Hm.. Yah, I hadn’t used it as a webpart. And, yah, that’s what happens for me, too. I’ll have to do some investigation. I’ll post an update when I figure it out.

  3. Wow, thanks so much!! I’m so new with Sharepoint so I’ve been doing a bit of fiddling around but afraid to go too deep.

    1. Okay, so here’s the deal. If you use it on another page as a web part, you have to go through the same steps to format the title and add the css to hide the ECB all over again. I’m not sure why. Clearly, what I’m doing is not exactly what Microsoft intended. So, these sorts of oddities are bound to happen. But, you can definitely do it.

    1. When you use the preview pane style, they attach the ECB (the down arrow that lets you access the edit menu) the title item. All well and good unless you change the title item. When you do, if you click the down arrow, SP gets confused and drops out the title. Look at the screen shot here:

      As soon as you click that down arrow, the text for the title disappears. The only workaround I’ve come up with is to hide the ECB menu by setting it so that it doesn’t display via the CSS.

      Make sense?

  4. I think I understand. However, when I tried it, it removes the ECB but doesn’t show my left side change.

    Here’s a screenshot of the successfully changed preview pane view to show organization, not name, on the left side:

    I inserted the text file (copied your code) into the documents of this sub-site I’m working on.

    Here’s me on the page I created, selecting the “39Preview” view for the Web part:

    And here’s the result when I click ok and save the page:

    While it definitely removes the ECB, it doesn’t change my left side view.

    Didn’t get to the breadcrumbs fix, because I’m not too worried about that right now…

    1. I think you missed the part where I said that if you’re doing it on a page that isn’t the view page itself, then you have to open that PAGE in SPD and redo your customizations. In other words, you use SPD to customize a view IF you’re using it on the default view page. If you’re using it on a Web Part Page, don’t bother customizing the view. Add a view using the preview pane style to the page and then customize the webpart on the page.

      Make sense?

      The bonus is that on a web part page the breadcrumb thing isn’t going to be an issue.

  5. The code isn’t the same in the page as it is in the view. So I don’t know which code to replace? I don’t see a way to just edit the Web part code?
    Sorry to be a total pain…I really appreciate your help!!

    1. I’ll try to do a screencast on Monday. I can’t access my test environment from home. But, if you follow the instructions (right click on the title field and then select “edit formula” and select the column you want to display), you shouldn’t need to alter the code directly. It should do it for you automatically.

  6. I’m trying to use a custom column that formats as a picture for my picker column. Can’t get it to work though. It only displays the url path instead of the image. Any advice would be appreciated.

    1. I don’t have any off hand experience doing that. But, I’m guessing it wouldn’t be much different. On your select tag, did you add disable-output-escaping=”yes”? So, in your XLST template, you’d have something like so:

      <xsl:value-of select="$thisNode/@YourImageColumn" disable-output-escaping="yes"/>

  7. Your Tutorial is really great. Thank you so much! I just have another question and perhaps you could help me with that, too? It’s merely simple, but I haven’t found an easy solution yet. In the standard List view, there is a Link to the “add new element” form below the list . When I use preview pane, sadly it’s not appearing. I know that it’s there when you click the ribbon, but I want the link 😉 And I haven’t found such an option yet. Would be great if you could help me out.

    Best regards,

    p.s: Sorry I use the german version (for I am german) of SharePoint so I don’t know the exact english descriptions. I hope you understand what I want.

  8. So we have a blank Title Field from exporting an Access DB to a list. All we wanted was the Part Number to be the ‘Title’. No matter what we tried to do in Access to export it, SP2010 added a title field (exporting from Excel I’ve been told takes the 1st Text/Single String, but we wanted to keep relationships).

    Once nice thing is we’re moving away from Access for tracking and adding new items, so this will be a solely web-based solution for item tracking.

    Pouring over this issue since yesterday morning, the lightbulb went off on how to make the Part Number field the Title Field. Like, the get hit in the head with a brick type of answer.

    If you didn’t want to concatonate the list on the left pane from 2 separate fields, my rough around the edges solution was…

    “How to make the Title Field contain the content of a Column”

    1) Open the List in Datasheet View
    2) Select all the cells from “Part Number”, right click, CUT.
    3) Wait a bit while SP syncs.
    4) Select the top cell in “Title”, right click, PASTE.
    5) Browse CNN for a few min in another tab while the sync goes on.
    6) Delete the old “Part Number” row.
    7) Rename “Title” to “Part Number”

    I could not believe how easy that was to do and solves our problem. Of course, you can name the “Title” whatever you want to match the column you’re going to delete.

    One thing to remember… when referencing that column name, it’s still known as “Title” and not “Part Number”. Part Number (Or whatever you named it) is just a display tag, as “Title” is a needed and reserved system name).

    Now on your forms or list, you can re-order it as you want too, just that in the preview pane, it’ll take “Title” or your new name as the link/mouseover/ECB.

  9. Deanna, I’ve followed this fairly successfully, but I don’t know how to change the title field (with the link to view the item) to simply the text of the title field (without the hyperlink). I just want the users to hover over the names on the left column of the preview pane, without clicking to view it. Any ideas?

    1. To get at that, you’re going to have to click on Design in the List View Tools part of the ribbon and then click the “Customize XSLT” and choose to customize the entire view. Then, you’re looking for this (search for “301”):

      <a onfocus="OnLink(this)" href="{$FORM_DISPLAY}&ID={$ID}&ContentTypeID={$thisNode/@ContentTypeId}" onclick="EditLink2(this,{$ViewCounter});return false;" target="_self">

      That’s where the link is built. Change the a to a div (don’t forgot the closing div), remove the onClick function, and you’ll still have the hover effect. It’s not the most semantically correct (div with a href? Hm….). But, it’s a quick hack to do what you’re asking. The more correct way would be to take the onLink(this) function and make it work with properly with a div instead of an anchor.

  10. Right now it seems like BlogEngine is the preferred blogging platform available
    right now. (from what I’ve read) Is that what you are using on your blog?

  11. Hi, thank you for this, exactly what I was looking for 🙂

    I made it so that the list shows the name of suppliers rather than the title, but now the pane shows Title AND Supplier and both are the same.

    Title is hidden from forms and is not a required field. If I go into the view controls to remove it it is greyed out.

    Also, I can’t get the breadcrumb bit to work. I’ve insterted the code exactly as instructed but it’s not effecting the page. Is there any obvious thing I may have missed?

    Any help on this would be greatly appreciated.



    1. I’m assuming you mean in the preview pane itself, right? For that, you need to do some more XSLT customization. So, with your cursor in the preview pane, go up to the list view tools -> Design part of the ribbon. In the “Actions” section, there’s a “Customize XSLT” drop down. Choose, “Customize Item.” Now, find where the XSLT loops through the fields and displays them. (Click in any of the preview pain rows and it should put you in roughly the right place in the code in split view.) You’ll need to wrap that table row in an if statement, like so:
      <xsl:if test=”@DisplayName != ‘Title'”>
      <td nowrap=”nowrap” valign=”top” width=”190px” class=”ms-formlabel”>
      <xsl:value-of select=”@DisplayName”/>
      <td valign=”top” class=”ms-formbody” width=”400px” id=”n{position()}{$WPQ}”>


      Make sense? This displays everything except the title. Obviously, alter the IF logic to meet your needs.

  12. Morning,

    Having slept on it I realised my mistake: that I need to press save, rather than refresh then save. Weird, but it worked.

    Could still do with some help on the title thing, though it’s not super important because I just hid the Supplier name field and left the Title field as an acceptable work around.

    Thanks once again, your solution has fixed two major problems I was having!


  13. Is there any way to implement your solution without the use of SPD? At my work – the system doesn’t have it enabled and it’s not an “approved” application yet.

    So what I have created is a very large list of projects with their various details (about 15-20 columns ‘deep’) and I set it up so that the default view uses the Preview style – which is fantastic! – the only down side is that the person I created the list for would really prefer it if there were some way for the first THREE columns of the list to show on the left side of the screen for each item, instead of just the ONE “title” column (which we have set up as Project Name). The other two columns would be Project Number and PM – although I guess it doesn’t really matter which ones I’d be using – I’m guessing the ‘code’ is the same, just substitute the name of the column in question.

    Anyhow – if there is someway for me to dig into the source code and figure this out – that would be AWESOME.

    1. You could possibly do it with jquery and web services. But I’d have to do some digging to figure out how. If you have SharePoint and no SPD you are severely limited. You can have your SharePoint admins restrict who can access it and what one can do. I’d ask for it to be considered.

  14. This is great. Do you have any solution with adding in-line editing in this view? Would be spectacular if we could manipulate this view and allow users to edit the items without going into each item.

  15. Hi there,

    I have an aspx page (called viewme.aspx) which I created in SharePoint Designer.
    I’ve added a web zone, followed by inserting a dataview.

    I then went back into sharepoint. Created a new page (mainpage), added a web viewer part, and linekd to the viewme.aspx created in Deisgner to view my list.

    Problem is that the ECB menu is still showing….
    So I then created the ecbhide.txt file with your code in, and added another webpart (content editor) to my SharePoint mainpage but the ECB is still showing within the Page Viewer.

    I’ve looked at the code in the viewme.aspx and there is no reference to “PlaceHolderAdditionalPageHead.”

    So how can I add the ECB code to my aspx file please?


    1. Did you add the hide text webpart to the viewme.aspx page? The page viewer webpart is pretty much like an iframe, so things you want to do on the viewme page need to be done on the viewme page.

      1. I didn’t know where to put your coding within the viewme.aspx page as there is no references to the ““PlaceHolderAdditionalPageHead.” code, so I went with the other option to create a txt file, put the ecb code in there and saved it.

        Then on my mainpage in SharePoint, added 2 webparts, one is a Page Viewer, the other a Content Editor. In the Pageviewer, I link to the viewme.aspx and in the Content editor, I link to the hideecb.txt file.

  16. Added the Content Editor to the viewme.aspx in SharePoint Designer, but then i’m not sure how to add the hideecb.txt to it. There is no Graphical way to add the hideecb.txt to the content editor this way.

    Any ideas on how to enter the ecb via code?

    The content editor webpart (when it split screen) shows this for the newly added content editor:

    Allows authors to enter rich text content.

    So I guess I need to know where to enter the ecb code in there.

    1. In SPD, right click the content editor web part. Select “Web Part Properties.” A modal window will open. The first option in that is to “include a file” (or some such language). This is where you include your document relative path to the hideecb.txt. You’ll also want to scroll down in the modal to the section that lets you change appearance and change the toolbar to “none” so the CEWP isn’t visible on the page.

  17. That worked perfectly, sorry for being such a noob, fairly new to this sharepoint thing.
    Can’t thank you enough.

    One last thing I hope you can help with, is it possible to default the value in the preview pane to the first record? When the viewme.aspx page loads, the main table which holds the data is blank, obviously you hover over one of the items on the left side, which then fills in the fields on the main table on the right.

    Is there any code you know off that I can enter in my viewme.aspx page to default it to the first record?

    Again, thank you so much with your help, it’s been a huge help!

  18. Pretty section of content. I just stumbled upon your
    site and in accession capital to assert that I acquire actually enjoyed account your blog posts.
    Anyway I will be subscribing to your feeds and even I achievement you access consistently fast.

  19. Is anyone around here? I need some help. Can we do away with not hovering the mouse over the webpart to see the information. Can we see the information as the entire page laods for the first time? but still using preview pane?

Leave a Reply

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

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

Facebook photo

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

Connecting to %s