function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vandana RattanVandana Rattan 

Display SOQL results in Visualforce page

I have created a Custom Lead Convert Page. I need to show a list of duplicate contacts on Lead Conversion. I have been trying to do so using Apex:Repeat and Apex:PageBlockTable but nothing is getting displayed. My SOQL does return results. Kindly suggest. My Controller and Visualforce Page are given below:-

VisualForce Page:
<apex:page standardController="Lead" extensions="LeadConvertController">
    <apex:includescript value="" />
     <apex:sectionHeader title="Convert {!$ObjectType.Lead.label}" subtitle="{!}"/>
    <apex:form id="leadForm">
        <apex:pageBlock mode="edit" >
        <apex:pageblockbuttons >
                <apex:commandbutton value="Convert" action="{!ConvertLead}"/>
                <apex:commandbutton value="Cancel" action="{!Cancel}"/>
        <apex:pageblocksection id="LeadConvertPBS" title="Convert Lead">
        	<apex:pageBlockSectionItem >
            <apex:outputLabel value=" Record Owner" for="Record Owner"/>
                <apex:inputField value="{!lead.OwnerID}" id="recOwner1" />
            <apex:pageBlockSectionItem >
            <apex:outputLabel for="Account Name">Account Name</apex:outputLabel>
             <apex:inputField required="true" id="company" value="{!lead.Company}" />
          <apex:pageBlockSectionItem >
           <apex:OutputLabel for="Send Email to the Owner">Send Email to the Owner</apex:OutputLabel>
           <apex:inputCheckbox onclick="{!lead.Ownerid}"/>
          <apex:pageBlockSectionItem >
            <apex:outputLabel for="Oppt Name">Opportunity Name:</apex:outputLabel>
             <apex:inputField required="true" id="opptName" value="{!lead.Company}" />
          <apex:pageBlockSectionItem >
                      <apex:outputLabel for="ConStatus">Converted Status:</apex:outputLabel>
             <apex:inputField id="ConStatus" value="{!lead.Status}" />
          <apex:pageblockSectionItem >
             <!-- <apex:outputLabel for="no oppty">Do not create new opportunity upon conversion</apex:outputLabel>
              	<apex:inputCheckbox id="noOppty"/>-->
        <!--<apex:outputPanel id="contactList" layout="block">
        	<apex:pageBlockSection title="Contact List">
            <apex:repeat value="{!lstDupContact}">
				<apex:outputText value="{!lstDupContact}"></apex:outputText>            
        <apex:pageBlockTable value="{!lstDupContact}" var="ct">
            <apex:column value="{!}"/>
            <apex:column value="{!ct.firstName}"/>
        	<apex:column value="{!ct.lastName}"/>
public class LeadConvertController{
    Lead lead;
    public List<Contact> lstDupContact {get; set;}
    public LeadConvertController(ApexPages.StandardController controller) {
		this.lead = (Lead)controller.getRecord();
    public PageReference ConvertLead(){
        System.debug('Inside Lead Convert Controller');
        Database.LeadConvert lc = new database.LeadConvert();
        Lead leadRecord = [SELECT firstName, lastName, email from lead where id =: lead.Id];
        System.debug('lead Owner >> ' + lead.OwnerId);
        //GroupMember grpMember = [Select UserOrGroupId from groupmember where groupid= :lead.OwnerId];
        //System.debug('GroupMember--->' + grpMember.UserOrGroupId);
       // Database.LeadConvertResult lcr = Database.convertLead(lc); 
          //  String aId = lcr.getAccountId();
            lstDupContact = [SELECT id, firstName, lastName, email from Contact where (firstName =: leadRecord.FirstName OR lastName =: leadRecord.LastName) AND email =:];
            System.debug('lstDupContacts >>>' + lstDupContact);
            PageReference redirect = new PageReference('' + lead.Id + '&sfdc.override=1');
            return redirect;
        return new PageReference('/'+'');
    public List<Contact> getLstDupContact(){
        return lstDupContact;

Best Answer chosen by Vandana Rattan
James LoghryJames Loghry
Try returning null at line 31 (instead of a new PageReference).  Also, add a rerender="leadForm" to your Convert command button.  See if that helps.

All Answers

James LoghryJames Loghry
Try returning null at line 31 (instead of a new PageReference).  Also, add a rerender="leadForm" to your Convert command button.  See if that helps.
This was selected as the best answer
Vandana RattanVandana Rattan
Thanks a ton James. It worked..