Wednesday, 21 September 2011

Tuesday, 20 September 2011

How to display multiple visual force pages using controller?

Hi,

I have posted this question in discussion boars.I didnt get any response.Please help me to find a solution for this.

Im using 2 vf page and a controller.
One VF is used to select multiple values from the list view.When i select multiple values the values should display in visual force page.I have created a button there named Print.When i click that button i should get the print of (Second VF) all the pages.
Second VF is the page which is to be printed.
Im using controller to print the Second VF page.My issue is In controller inside for loop all the page are printing.Outside the loop it will return only one page.

First VF page

<apex:page standardcontroller="Payment_Schedule__c"  recordsetVar="pay1" 
extensions="MassPrintSimpleController" showHeader="true">

<apex:form >
<apex:pageBlock mode="edit">
<apex:pageBlockSection >
<apex:pageBlockTable var="a" value="{!selected}">
<apex:column value="{!a.Opportunity__c}"/>
<apex:column value="{!a.Name}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Print"  action="{!print}">
</apex:commandButton>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>

Controller:

public  class MassPrintSimpleController {

    public id Oppid; 
    public  ApexPages.StandardSetController cntr;
    private PageReference pr;
    public List<Payment_Schedule__c> pay{ get; set;}
    public Payment_Schedule__c pay1;
    public MassPrintSimpleController(ApexPages.StandardSetController 
controller) {
        system.debug('Controller111111111111');
        cntr = (ApexPages.StandardSetController)controller;
        system.debug('Controller'+cntr);
        pay=cntr.getSelected();
        system.debug('PaymentSchedule111111'+pay);
    }
     
    public PageReference print() {
    
        system.debug('Printttttttttttttttt');
        system.debug('Payment11111111111'+pay.size());
        system.debug('Pay Id: ' + pay[0].id);

        for(Payment_Schedule__c pay1:pay) {  
        system.debug('DemandLeterSize'+pay.size());    
        
             pr =new PageReference('/apex/DemandLetterPrint?id='+pay1.id);
             pr.setRedirect(true);
             System.debug('PrintPDF'+pr);
             System.debug('printing pdf'+pay1); 
                             
              }
              return pr;
              }
              }
 
Anyhelp would be highly appreciated.

Thanks
Speculator
 



Thursday, 25 August 2011

How to call multiple objects in a wrapper class in Salesforce?

Hi,

I have two customObject like Payment_Schedule__c and Receipt__c.I want to display in VF page as table .So I used apex:repeat tag.I  have created the apex class like this which i mentioned below. Iam able to see the added list of item in debug. But if i called the list in VF page i will get the data.But it will repeat data.So how i can remove duplicate datas .Is it possible to write wrapper class for multiple objects?Can anyone help me to find a solution for this.

Thanks
Amritha