You need to sign in to do that
Don't have an account?
Chinnu Chinnu
Can anyone please tell me how to do this VF page
Hey, This is my code..
VF page:
<apex:page controller="ContactsVisualforceController" standardStylesheets="false">
<apex:form>
<apex:pageBlock title="Contacts List">
<apex:repeat value="{!displayAccounts}" var="acc">
<dl>
<dt>Account Name:</dt>
<dd><apex:outputText value="{!acc.Name}"/></dd>
</dl>
<dl><dt>Contact Names:</dt></dl>
<apex:pageblocktable value="{!acc.Contacts}" var="cont">
<apex:column value="{!cont.firstname}"/>
<apex:column value="{!cont.lastname}"/>
</apex:pageblocktable>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class ContactsVisualforceController {
public list<Account> displayAccounts {get; set;}
public ContactsVisualforceController(){
displayAccounts = [select id,name,(select id,name,firstname,lastname from Contacts) from Account];
}
}
This is working fine ok.. But now I want to display as Block means
AccountName1 here All related Contacts For that AccountName1 should display here
AccountName2 here All related Contacts For that AccountName2 should display here
AccountName3 here All related Contacts For that AccountName3 should display here
like this I want to display 10 records in one page and another 10 records on another page so pagination we have to use..
So I want how can we do that can anyone please tell me..
VF page:
<apex:page controller="ContactsVisualforceController" standardStylesheets="false">
<apex:form>
<apex:pageBlock title="Contacts List">
<apex:repeat value="{!displayAccounts}" var="acc">
<dl>
<dt>Account Name:</dt>
<dd><apex:outputText value="{!acc.Name}"/></dd>
</dl>
<dl><dt>Contact Names:</dt></dl>
<apex:pageblocktable value="{!acc.Contacts}" var="cont">
<apex:column value="{!cont.firstname}"/>
<apex:column value="{!cont.lastname}"/>
</apex:pageblocktable>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class ContactsVisualforceController {
public list<Account> displayAccounts {get; set;}
public ContactsVisualforceController(){
displayAccounts = [select id,name,(select id,name,firstname,lastname from Contacts) from Account];
}
}
This is working fine ok.. But now I want to display as Block means
AccountName1 here All related Contacts For that AccountName1 should display here
AccountName2 here All related Contacts For that AccountName2 should display here
AccountName3 here All related Contacts For that AccountName3 should display here
like this I want to display 10 records in one page and another 10 records on another page so pagination we have to use..
So I want how can we do that can anyone please tell me..
Here is the simple example code for pagination according to this code you can make changes in your code
Thank You
www.nubeselite.com
Developement | Training | Consulting
Please Mark this as solution if your problem resolved.