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>
  • 1
    you need wrapper class here example developer.salesforce.com/page/Wrapper_Class – Ratan Paul Jan 13 '16 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 '16 at 9:49
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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.