First of all thank you for you kind welcome! Now I need to start working…
I love using Data views! It's very flexible, looks good (if you're doing it right) and you can do a lot of things that aren't available in the custom SharePoint web parts (in the browser).
This post is very basic one – it is the first steps for creating data views. A lot of my posts in will deal with data view so I thought I should start with step-by-step post. Let's start…
Create a page in the SharePoint site and publish it. Go to SharePoint Designer, open you site and then open Pages library. Right-Click on the page you have just created and choose detach from page layout. The idea is that you can edit the page in the designer and later on reattach it to the page layout.
Do not to change the layout components (tables, web parts zone etc’) if you want later to reattach the page to its layout.

Go to the menu bar and chose Task Pane and then Data source library. The data source window will appear in the right side of the screen.

Chose your list / library and click show data.
Select the fields you would like to show in your data view and click insert selected items fields as… .In this example I will use Multiple items view.
before you click insert selected items fields as… make sure that one of the web part zone is selected. If not - just click on it.
Now we have the data view – but what can we do with it?
If you click the small arrow next to the data view – you will see the Common Data view Tasks menu.
Here are some suggestions what to do with this menu:
- Filter – as you filter in the browser and also by parameters. That meaning is that you can choose more parameters to filter by (like URL parameters and more). I’ll explain this in another post.
- Sort and Group – You can group by more than 2 properties.
- Edit columns – to add or delete columns from you data view. They can be added/deleted in the design view as well.
- Web Part connection – with this option you can connect web parts in the same page (also available in the browser) and in another page – a very nice option. I’ll deal with this issue in the future as well.
- Parameters - you can define you parameters (as part of the filter option).
Some tips for customization of the data view:
Link the document name to the document (after all we want the user to see the file…):
- Click on one of the documents name (it is actually the document filed)
- Click on the small arrow that will appear next to the field.
- Change the “Format as” from text to hyperlink.
- When prompted click yes.
- Change the address – click on the (fx) button next to address filed and choose URL Path and click Ok. You will see the filed is now contains: {@FileRef}.
the Text to display filed was changed. You will need only {@FileLeafRef} for this example – so delete anything that you don’t want.
- Click Ok.

Remove the view header – Some customers ask me to hide the view header. When I'm saying "View Header" I mean the row that displays the name of the columns (stroked in the following picture).
There are 2 ways to do that:
- With SharePoint Designer: all you have to do is select this row and delete it.
- CSS – add a new class in your custom css file. Remember this change will be implemented to all of the web parts in the site. If you would like to do that add this to you css file:
.ms-viewheadertr {
display:none;
}
Change the background color of the “Group By”: Although this cell has css class (ms-gv) the background color is defined in the style tag of the td. In order to change the gray background look for background:#cccccc In your code. Here you also have 2 ways:
- Change the #cccccc to another color.
- Delete the background attribute, define the background in a custom css class and then replace “ms-gb” class with your own class. Needless to say that this is my favorite option.
Change the items background color: you probably noticed that the background of the first item is white and second is gray. You can changes this, also in 2 ways:
- Delete it: if you don't want this changing color you can delete it from the code:
<xsl:if test="position() mod 2 = 1">
<xsl:attribute name="class">ms-alternating</xsl:attribute>
</xsl:if>
- Change the css: as you can see in this code every time that the position is odd the data view is using the ms-alternating class. Again – you can add this class to your custom css and overwrite the old one. You can chose another background color or you can replace it with white color (this will be implemented all over the site).
- Another option is to replace the ms-alternating class in the code to your custom css – this will be implemented only in this data view.
When you finish changing the look and feel of you data view save your changes and then right-click on the page name. Chose "Reattach to page layout". If you didn’t change anything in the page layout you will be notice that the page was reattached successfully – Click Ok.
Now check in the file and publish a major version of it. Click F12 to see the page.
To sum up… here is a list of advantages and disadvantages that can help when you don't know which option to choose (Data View or Browser Web Part) .
Advantages:
- Disable “View Header” locally.
- Display data that is not for the same level of hierarchy – That means that in the home page you can display libraries and lists from other site in your site collection.
- More design option and flexibility.
- Group by more than 2 properties.
- Show calculated date base on xsl function (I will deal with this issue in the future).
- On item view.
Disadvantages:
- The end user can edit the web part (it can also be advantage – depend on you dements)
- For every change you will have to open the SPD.
My name is Inbar Cizer and this is my first post. After a long time of thinking about it I decided to do it – to open my own blog.
In my job I'm implementing SharePoint for Omnisys ltd. For a while I had love/hate relationship with SharePoint (aren't we all?) but after a while I realized that I know all kind of tips that, hopefully, can help others. In this blog I'll write about them.
Apart from implementing SharePoint I'm also a student at Tel Aviv University school of mass communication and political science, which is very interesting but have almost nothing in common with my job.
I hope you will find my blog helpful.
Inbar