1

I have SharePoint 2010 list with a custom view that I ripped most of the XLST out of and put my own in. It displays correctly if I open the list and switch to that view.

However, if I add a List Web Part to a page and pick that view, I only get a regular looking list view. How do I display my customized view?

1

Alternate Custom solution .

  1. Copy the OOB “ViewPage.aspx” and place it in the same folder as “CustomViewPage.aspx”
  2. Create the custom web part which shows the items of the view with your custom approach.
  3. Create a feature to provision the “CustomViewpage.aspx” along with your custom web part.
  4. Create a custom list definition. In the schema.xml file of the definition for all the views mention the “SetupPath” to refer your “CustomViewPage.aspx”. With this step all the views mentioned in the list definition will use the “CustomViewPage.aspx” to create the view pages and as well all the views which you create after the creation of the list will use the “customViewPage.aspx” as the base page to create the view pages.
0

It depends how List View web part has been customized.

XsltListViewWebPart class exposes two properties for setting XSL:

In addition SPView class exposes two properties to set XSL:

Please refer an article XsltListViewWebPart – several XSLT tips for a more details.


I guess, you customized your View via SharePoint Designer (Customize XSLT button). In that case your custom Xsl has been applied only to web part (via XsltListViewWebPart.Xsl) located on the page where you modified it.

Solution

Since only XsltListViewWebPart.XslLink property could be set via the SharePoint UI, the following approach is recommended:

Steps:

  • Save your Xsl code into file and place file into, for example, into Style Library (under /Style Library/XSL Style Sheets/)

  • Add web part on page, open page in Edit Mode, open List View Web Part Properties and specify XsltListViewWebPart.XslLink property: /Style Library/XSL Style Sheets/customview.xsl

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.