0

i want to show checkbox before every contact in data table

<apex:page controller="ContactCheckEditController">
    <apex:form>
        <apex:pageBlock title="Contact" tabStyle="contact">
               <apex:column headerValue="Edit">
                   <apex:inputCheckbox/>
               </apex:column>
               <apex:column value="{!cont.firstname}" headerValue="First Name"/>
               <apex:column value="{!cont.lastname}" headerValue="Last Name"/>
               <apex:column value="{!cont.phone}" headerValue="phone"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>
2
  • 1
    you need wrapper class here example developer.salesforce.com/page/Wrapper_Class
    – Ratan Paul
    Jan 13, 2016 at 9:36
  • @Vipin The error message says it all. <apex:column> can only be used inside a <apex:pageBlockTable> or <apex:dataTable>. But in your code, you have used it directly inside <apex:pageBlock>
    – ajinkyah
    Jan 13, 2016 at 9:49

1 Answer 1

3

You cannot use <apex:column> directly in <apex:pageBlock> . You are code should be like this.

<apex:pageblock>
<apex:pageBlockTable value="{!contactlist}" var="cont"><!--HERE I HAVE USED CONTACT AS LIST WHICH WILL BE IN CONTROLLER-->
       <apex:column headerValue="Edit">
                   <apex:inputCheckbox/>
               </apex:column>
               <apex:column value="{!cont.firstname}" headerValue="First Name"/>
               <apex:column value="{!cont.lastname}" headerValue="Last Name"/>
               <apex:column value="{!cont.phone}" headerValue="phone"/>

</apex:pageBlockTable>
</apex:pageblock>
0

You must log in to answer this question.

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