+ Start a Discussion
Maxi SMaxi S 

How to display images row by row in visual force page

I want to display only two images in one row.  

Using my code all images are displayed in a single row.

VF Page :

<apex:page standardController="Flat__c" extensions="displayImageExtension">
<style>
img:hover 
{
height: 400px;
width:  400px;

</style>
<apex:repeat value="{!file}" var="p">
<apex:panelGrid columns="2" style="width:100%;" id="theGrid">
<apex:image id="theImage" url="/servlet/servlet.FileDownload?file={!p.Id}" width="100" height="100" />
</apex:panelGrid>
</apex:repeat>
</apex:page>
 
adil muzaffaradil muzaffar
can you share your extension logic also
Maxi SMaxi S
public class displayImageExtension {

private id StCustId;
List<Attachment> file;
 
public displayImageExtension(ApexPages.StandardController stdController) {
this.StCustId = ApexPages.currentPage().getParameters().get('id');
}

public List<Attachment> getfile(){

file=[Select Id,Name,LastModifiedDate from attachment where ParentId=:StCustId];
return file; 
}
 
}
Eswar Prasad@Sfdc11Eswar Prasad@Sfdc11
hi Maxi,
In above scenario,pls see below link it will helpful to you
http://sfdcsrini.blogspot.com/2014/07/data-table-with-custom-styles-in.html

Regrads,
Eswar prasad.
 
Maxi SMaxi S
Thank you guys.

Below code is working properly.

<apex:page standardController="Flat__c" extensions="displayImageExtension">
<style>
img:hover 
{
height: 400px;
width:  400px;

</style>
<apex:variable value="{!0}" var="rowNum" />
<apex:repeat value="{!file}" var="p">
<apex:image id="theImage" url="/servlet/servlet.FileDownload?file={!p.Id}" width="100" height="100" />
<apex:variable var="rowNum" value="{!rowNum + 1}" />
<apex:outputText escape="false" value="<br/>" rendered="{!rowNum = 2}"/>
<apex:variable var="rowNum" value="{!0}" rendered="{!rowNum = 2}" />
</apex:repeat>
</apex:page>