I am trying to get the latest three images added to a picture library and put them on home page with XSLListViewWebPart but can't manage it to work. Here is the sample output I am trying to get:

 <img src="s-1.jpg" alt="" /><img src="s-2.jpg" alt="" /><img src="s-3.jpg" alt="" />

Is it ok to use XSLTListViewWebPart for this or should I choose any other way?



I have found one nice example that uses Content Query WebPart (CQWP):

Customize Content Query Webpart in Sharepoint 2010 and Deploy it using Visual Studio 2010

Similar question: Rendering images in a content query webpart

And a much simpler solution: How to Use SharePoint 2010 Content Query Web Part (CQWP)

I would go in this direction if custom layout is needed. XSLListViewWebPart is more list oriented.

| improve this answer | |

Content Query WebPart (CQWP) maybe a better choice for you. Try this:

  1. Insert a CQWP into your page, then
  2. Config the CQWP, select the Picture Library as the "Query" source, then
  3. Select "Created" as the "Group and Sort"'s sort column and check the "Descending" option, then
  4. Set "Limit the number of items to display" to 3, then
  5. In the "Style" section, select "Image only, clickable", then
  6. Change the CQWP's Title in the "Apparence" section, then
  7. Save your configuration.

by default, the CQWP will layout your images in vertical. if you want a horizontal layout, you can add this css style into your page or into a Content Editor Web Part:

    .dfwp-item {
| improve this answer | |

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.