Tips on xslt dataviews by Mark Kruger!
Take a look at "Free SharePoint DataView Tips" by Mark Kruger. Useful!
Sharepoint Tips And Tricks is Ishai Sagi's sharepoint information blog. It specializes in Microsoft SharePoint technologies, including web parts, development, configuration, customization, and best practices for the use of Microsoft SharePoint Server and Windows SharePoint Services. It also provides some related Office Information, including VSTO and VSTA and other office application development tips.
Take a look at "Free SharePoint DataView Tips" by Mark Kruger. Useful!
Posted by
Ishai Sagi [SharePoint MVP]
at
1:28 AM
0
comments
Links to this post
Labels: XSLT, XSLT Data Views
An XSLT dataview is a great way to modify the look and feel of displayed data in a sharepoint site. The dataview web part is able to display data from either sharepoint lists, or from external data sources.
This article will focus on how to create a simple xslt dataview for a sharepoint list.
First we will create a sharepoint list - Contacts, and fill it with some sample data:
Now, lets create a new page that we will use to create the xslt dataview in:
Open the page in SharePoint Designer (see my previous article if you forgot how - you will need to detach it from the page layout first!).
Now we can add the contacts list to the page using sharepoing designer. You can also do that from the browser before opening the page in sharepoint designer if you prefer:
Let us work in a clean environment - change the properties of the web part so it doesn't display the toolbar. Annoyingly, in sharepoint designer this means you have to open the dropdown menu for the web part (looks like a list icon) and select "change layout":
Select not to show a toolbar.
Now we can transform the web part to an XSLT dataview. Just right-click the web part and choose "convert to xslt data view":
The page should flash and then the web part will appear again, only slightly different. A new menu will appear with a lot more options (filter, sort and group, paging, edit columns, change layout, data view preview, show with sample data, conditional formatting, web part connections, parameters, refresh dataview, dataview properties).
Now you can start playing with it!
In this article I will not go over all the options - I will just conclude by showing you the conditional formatting, and how to deploy the web part to another page in the site:
Click on "Conditional Formatting" in the common data view tasks menu:
The task pane on the right should change to the "Conditional Formatting" pane. Now we can click a row (any will do), and then click the "create" menu, and choose "apply formatting" from the menu:
Because we selected a row, we can apply formatting to that row based on rules we will now define in this screen:
In this example I chose the rule - when first name is "Ishai". Press OK to get to the formatting options:
I set the formatting to show my contact's row with a light blue background, in bold and in uppercase.
Save the file, and view it in the browser:
As you can see - it shows exactly what I wanted it. Now to deploy it to the home page of the site (which we didnt want to detach from the layout page):
In the browser, open the actions menu for the web part and click "export":
Now save the file to your desktop, and go to the homepage of the site. Switch to "edit page mode", click on "add a web part" in one of the zones, and then on the "advanced web part gallery and options" link at the bottom.
Use the dropdown at the top of the pane to switch to web part import pane:
Now, browse to the saved file and click the "upload" button. The web part should appear as an option in the pane. Drag and drop it to the zone you want it in:
And now you can click on "Exit Edit Mode" and see your wonderful new home page, that is still attached to it's layout page!
The next article will show how to do the same, but with external data!
Posted by
Ishai Sagi [SharePoint MVP]
at
12:14 AM
3
comments
Links to this post
Labels: SharePoint 2007, SharePoint Designer, XSLT Data Views
I see a growing amount of questions about the SPD dataviews, or questions that can be answered by "use the dataview web part", so I thought I will start a new series of articles of "how-to"s to show how to do common actions using the dataview web part.
I will start by an article on best practices of using the dataview web part - how you should approach using it. Then I will start showing examples of modifying it, using either the built-in menus, or custom xslt samples.
This is actually an upgrade to some articles I have written in the past on how to use the xslt dataview in frontpage, on this blog and in MSD2D.com.
While I am always open to suggestions on what to show, please keep in mind that I will not do your projects for you. My aim is to show how this cool feature can make your life easier, so don't bother posting complex scenarios of things you want to achieve. Simple questions like "can you explain how to use conditional formatting" or "can you give an example on how to transpose a list, so that the rows are columns" will be (probably) accepted.
Also, if you are asking for something, leave your email address (will not be published) so I can notify you when it's published.
So, keep your eyes opened on this blog (you mean you are not registered by RSS? not even by email? well, it's time!)
Posted by
Ishai Sagi [SharePoint MVP]
at
10:14 PM
1 comments
Links to this post
Labels: SharePoint 2007, SharePoint Designer, XSLT Data Views