+ Start a Discussion
Rahul AlladaRahul Allada 

Data Mapped from controller is not visible in VF page

I have tried retrieving values of data from the controller and map them to the VF page. But, the mapped data is not being visible on the VF page, whereas in the debug of the controller it is visible.

Below is my controller:

public with sharing class QuotePDFController {
    public quote__c quotesRecords {get;set;}
    public QuotePDFcontroller(){
        quotesRecords = new Quote__c();
        Quote__c quotesRecords = [select Id,Name,Lab_Request__c, (SELECT Id, Name, Product__r.Name FROM Quote_Line_Items__r) FROM Quote__c where Id =: ApexPages.currentPage().getParameters().get('id') Limit 1];
        system.debug('quote isssss '+quotesRecords.Name); 
    }}

Below is the VF page:

<apex:page  controller="QuotePDFController"
           readOnly="true"      
           applyHtmlTag="false"     
           sidebar="false"     
           showHeader="false"     
           cache="true"     
           renderAs="advanced_pdf">  

<html>
        <head>
            <style type="text/css">
                @page {
                <!--size: letter;
                margin: 15mm;-->
                    @top-center {
                     content: "";
                    }
                    @bottom-right {
                        content: "Page " counter(page) " of " counter(pages);
                    }
                    @bottom-left {
                        content: "THIS IS A COMPUTER GENERATED ORDER AND NO SIGNATURE REQUIRED"
                    }
                }
                
                .page-break {
                    display: block;
                    page-break-after: always;
                }
                
                body {
                    font-family: OpenSans-Regular;
                }
   
                table{
                    border: 1px;
                }
            </style>
        </head>
        <body>            
                        <table border="1" align="center" style="border-collapse: collapse;" padding="10px">
                        <tr style="padding-top: 5px;padding-right: 3px;padding-bottom: 5px;padding-left: 3px;">
                            <th>{!quotesRecords.Name} </th>
                         </tr>
                         <table>
        </body>
    </html>
 
Best Answer chosen by Rahul Allada
vijay kumar kvijay kumar k
Hi Rahul

Can you try once with the below updated constructor and let me know the status.
public with sharing class QuotePDFController {
    public quote__c quotesRecords {get;set;}
    public QuotePDFcontroller(){
        
        quotesRecords = [select Id,Name,Lab_Request__c, (SELECT Id, Name, Product__r.Name FROM Quote_Line_Items__r) FROM Quote__c where Id =: ApexPages.currentPage().getParameters().get('id') Limit 1];
        system.debug('quote isssss '+quotesRecords.Name); 
    }}
Regards
vijay