+ Start a Discussion
SFManiSFMani 

Error:Unknown property 'OpportunityStandardController.npe01__OppPayment__c'

I have a custom object Payment(npe01__OppPayment__c). on the Opportunity page from related list Payment, I am trying to access a field Schedule Date. But it gives me Unknown property 'OpportunityStandardController.npe01__OppPayment__c' error on the Visualforce page. Below are my apex and visualforce code.

Apex Code:
public with sharing class Receivable_Opp {
    public ApexPages.StandardController myRecController{get;set;}
    public  npe01__OppPayment__c  Rec {get; set;}

     public ApexPages.StandardController standardOppController;
    
       public Receivable_Opp(ApexPages.StandardController cntrl){
           standardOppController = cntrl;
           Opportunity opp = (Opportunity)cntrl.getRecord();
           Rec = [Select npe01__Scheduled_Date__c FROM npe01__OppPayment__c  WHERE npe01__Paid__c = true ] ;
           myRecController = new ApexPages.StandardController(Rec);    
        
    }
}

Visualforce Code:
<apex:page standardController="Opportunity" showHeader="false" renderas="pdf" extensions="contact_opp,Receivable_Opp">

<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>
    <td>
        <img src='{!URLFOR($Resource.Logo4567687)}' title="logo" />
        
    </td>
    <p align="center"><font face="Arial"><i>{!$Organization.Name}</i></font><br/>
    <font face="Arial"><i>{!$Organization.Street}</i></font><br/>
    <font face="Arial"><i>{!$Organization.City}</i></font>
    <font face="Arial"><i>,{!$Organization.State}</i></font>
    <font face="Arial"><i>{!$Organization.PostalCode}</i></font></p>
    <!--<td  align="right"><font face="Arial" >
    <b>Invoice for {!Opportunity.Account.Name}</b></font><br/>
   </td>-->
   
  
    
</tr>

<hr/>

</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>    <td width="65%"><font face="Arial" >
        Federal Tax ID: 27-0580207<br/>
        </font></td> 
        <!--<td width="50%">&nbsp;</td>-->
   <td width="50%"><font face="Arial">Invoice number: <apex:repeat value="{!Opportunity.Invoices__r}" var="line2">
   {!line2.name}</apex:repeat></font><br/>
  
   
   <font face="Arial">Invoice Date: <apex:repeat value="{!Opportunity.Invoices__r}" var="line2">
   {!line2.Invoice_Date__c} </apex:repeat></font></td>
 
   
  
</tr>
</table>

<br/>
<hr/>
<p><b><font face="Arial" color="#000080">Address Information</font></b></p>

<table border="0" width="100%" id="table2">
<tr>
       <td colspan="3">
           <font face="Arial">Child name: {!Opportunity.Account.Name} <br/><br/></font>
       </td>
</tr>
<tr>
       <td>          
           <font face="Arial">{!Contact.Name}<br/>
                             {!Opportunity.Account.BillingStreet}<br/>
                             {!Opportunity.Account.BillingPostalCode} {!Opportunity.Account.BillingCity}
           </font>
        </td>
        <!--<td width="50%"></td>
        <td >
           <font face="Arial">Ship To:<br/>
                              {!Opportunity.Account.ShippingStreet}<br/>
                              {!Opportunity.Account.ShippingPostalCode} {!Opportunity.Account.ShippingCity}
           </font>
        </td>-->
</tr>    
</table>
<br/>
<hr/>
<p><b><font color="#000080" face="Arial">Invoice Detail</font></b></p>
<table border="0" width="100%" id="table4">
<tr>
       <td bgcolor="#C0C0C0"><font face="Arial">Post Date</font></td> 
       <td bgcolor="#C0C0C0"><font face="Arial">Due Date</font></td> 
       <td bgcolor="#C0C0C0"><font face="Arial">Item</font></td>
       <!--<td bgcolor="#C0C0C0"><font face="Arial">Description</font></td>  -->  
       <td bgcolor="#C0C0C0"><font face="Arial">Credit</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Debit</font></td>
       <td bgcolor="#C0C0C0"><font face="Arial">Total Price</font></td>
</tr>
<tr>
       <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
       
          <tr>
             <td>{!npe01__OppPayment__c.npe01__Scheduled_Date__c }</td>
             <td>{!npe01__OppPayment__c.npe01__Scheduled_Date__c }</td>
             <td>{!line.PricebookEntry.Name}</td>
             <!--<td>{!line.Description}</td> -->                       
             <td>{!Opportunity.npe01__Payments_Made__c}</td>
             <td>{!Opportunity.npe01__Amount_Outstanding__c}</td>
             <td><apex:OutputField value="{!line.TotalPrice}"/></td>
          </tr>
       </apex:repeat>
         
</tr>
<tr>
        
       <td bgcolor="#C0C0C0" align="right" colspan="6">
       <font face="Arial"><b>Total:</b>&nbsp;<apex:OutputField value="{!Opportunity.Amount}"/></font></td>
</tr>
</table>
<br/>
<hr/>
<p><b><font color="#000080" face="Arial">Terms and Conditions</font></b></p>
<table border="0" width="100%" id="table3">
<tr>
        
       
        <td><font face="Arial">
              Payment Method:&nbsp;<apex:OutputField value="{!Opportunity.QuotePaymentMode__c}"/><br/>
              Payment Terms:&nbsp; <apex:OutputField value="{!Opportunity.QuotePaymentTime__c}"/><br/>
              Billing Frequency:&nbsp; <apex:OutputField value="{!Opportunity.QuoteBillingFrequency__c}"/><br/>
            </font>
       </td>
</tr>
</table>
<br/>
<p><font face="Arial">{!Opportunity.Conditions__c}</font></p>
<br/>
<hr/>
<table width="100%" id="table5">
Special Terms:
</table>
<p>&nbsp;</p>
<hr/>
<p align="center"><font face="Arial"><i>Copyright {!$Organization.Name}.</i></font></p>
</apex:page>

Could someone please indicate the error. Would be very thankful.
Best Answer chosen by SFMani
William TranWilliam Tran
Change this:

             <td>{!npe01__OppPayment__c.npe01__Scheduled_Date__c }</td>
             <td>{!npe01__OppPayment__c.npe01__Scheduled_Date__c }</td>

to this:

             <td>{!Rec.npe01__Scheduled_Date__c }</td>
             <td>{!Rec.npe01__Scheduled_Date__c }</td>

Thx

All Answers

William TranWilliam Tran
Change this:

             <td>{!npe01__OppPayment__c.npe01__Scheduled_Date__c }</td>
             <td>{!npe01__OppPayment__c.npe01__Scheduled_Date__c }</td>

to this:

             <td>{!Rec.npe01__Scheduled_Date__c }</td>
             <td>{!Rec.npe01__Scheduled_Date__c }</td>

Thx
This was selected as the best answer
SFManiSFMani
Bingo!! Thanks for the help William. It worked.