Important notice

Please note that this blog is discontinued here. All the posts are also coppied to my new blog at http://boris.gomiunik.net.
Important: Due to large amount of comment spam further commenting has been disabled here. If you wish to send me a comment, plase look up the same post on my new blog and leave comment there. Thanks!

11/13/2006

More than 2 columns in SharePoint Data view

If you insert a SharePoint Data View Web Part (DVWP) in a page using FrontPage or SharePoint Designer, you have some nice layout options. A lot of times I like to make a web gallery using picture library, but the DVWP has only a two-column layout. If you'd like to have more columns (for this example, let's make 4 columns), here's an easy way.

  1. When selecting layout of DVWP (in FrontPage select smart tag and click Style, in SharePoint Designer select Smart tag and select Change Layout), chose the two column layout:


  2. Next in source code look for mod 2 (you'll find 2 occurences)

  3. Replace the number 2 in both of those occurences with the number of columns you wish (for our example we'll make mod 4)
  4. At the end change or remove the width property of the table cell, which is set to 50%
    - Using tag selector select the element which is holding table with details


  5. Delete or correct the "Width" attribute, because you have more columns and each can't have 50% of width.

And there you have it. You're in control of columns now :-)

2 comments:

Anonymous said...

This is a good start but what I want to do is have a table with the column headings down the left side and then the records in columns to the right.. how do I achieve this?

Anonymous said...

Awesome! Thanks for posting the information. You saved me time.