0

I'm trying to fetch the contact record and showing on page using its showing error

Unknown property EditContact_controller.wrapperClass.conList

Which thing is unknown.

here is my controller

public class EditContact_controller{
    public List<wrapperClass> wrapClassList{get;set;}
    public List<contact> conList;
    public wrapperClass wc{get;set;}

    public EditContact_controller(){
        wrapClassList = new List<wrapperClass>();
        conList = new List<Contact>();
        conList = [SELECT Id, FirstName, LastName FROM Contact LIMIT 10];
        For(Contact co : conList){
            wc = new wrapperClass();
            wc.flag = false;
            wc.conWrap = co;
            wrapClassList.add(wc);
        }
    }
    public class wrapperClass{
        public boolean flag{get;set;}
        public Contact conWrap{get;set;}

     }
    }

Here is my VFPage

<apex:page controller="EditContact_controller" tabStyle="Contact">
<apex:form id="frm">
    <apex:pageBlock title="Contact Records">

        <apex:repeat value="{!wrapClassList}" var="contactTable" id="cont_Table">
            <table>
                <tr>
                    <th> Action </th>
                </tr>

                <tr>
                    <th> First Name </th>
                </tr>

                <tr> 
                    <th> Last Name </th>
                </tr>


                <tr>
                    <td> <apex:inputCheckbox value="{!contactTable.flag}"/> </td>
                </tr>

                <tr>
                    <td> <apex:outputField value="{!contactTable.conList.FirstName}"/> </td>
                </tr>

                <tr>
                    <td> <apex:outputField value="{!contactTable.conList.LastName}"/> </td>
                </tr>


            </table>           
        </apex:repeat>

    </apex:pageBlock>

</apex:form>

2 Answers 2

2

The name of the contact var in the wrapper is conWrap so you should use that

ContactTable.conWrap.FirstName
0

You need to change this and use conWrap instead of conList

            <tr>
                <td> <apex:outputField value="{!contactTable.conWrap.FirstName}"/> </td>
            </tr>

            <tr>
                <td> <apex:outputField value="{!contactTable.conWrap.LastName}"/> </td>
            </tr>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .