Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

Thanks.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|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:

<style>
    .dfwp-item {
      float:left;
    }
</style>
share|improve this answer
    
This is excellent. Thanks Jony –  Maria Burton May 11 '12 at 12:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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