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
Derek DolanDerek Dolan 

Error: <apex:column> must be the direct child of either <apex:dataTable> or <apex:pageBlockTable>

I am trying to add a table within a table , from what I can see I have added the block and the table but I am getting the following error


Error: <apex:column> must be the direct child of either <apex:dataTable> or <apex:pageBlockTable>

 
<apex:page controller="AddingChildController" >
<apex:form >
    <apex:variable var="rowNum" value="{!0}" />
    <apex:pageBlock title="Weekly Time Sheets">
    <apex:pageBlock >
    
        <apex:variable var="rowNum" value="{!0}" />
        <apex:PageBlockTable value="{!childList}" var="int">
        <apex:facet name="footer">
            <apex:commandLink value="Add" action="{!insertRow}"/>
            </apex:facet>
            
            
            <apex:pageBlockTable value="{!childList}" var="int">
        <apex:column headerValue="Pay Run">
                <apex:inputField value="{!int.Pay_Run__c}"/>                                      
            </apex:column>

        <apex:column breakBefore="true" colspan="2">
                      
            <apex:column headerValue="Lead Generator">
                <apex:inputField value="{!int.Lead_Gen__c}"/>                                      
            </apex:column>
            <apex:column headerValue="Pay Run">
                <apex:inputField value="{!int.Pay_Run__c}"/>                                      
            </apex:column>
            <apex:column headerValue="Monday">
                <apex:inputField value="{!int.Monday__c}"/>
            </apex:column>
            <apex:column headerValue="Tuesday">
                <apex:inputField value="{!int.Tuesday__c}"/>
            </apex:column>
            <apex:column headerValue="Wednesday">
                <apex:inputField value="{!int.Wednesday__c}"/>
            </apex:column>
            <apex:column headerValue="Thursday">
                <apex:inputField value="{!int.Thursday__c}"/>
            </apex:column>
            <apex:column headerValue="Friday">
                <apex:inputField value="{!int.Friday__c}"/>
            </apex:column>
             <apex:column headerValue="Delete">
            
            <apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
                <apex:param value="{!rowNum}" name="index"/>
                </apex:commandLink>
                <apex:variable var="rowNum" value="{!rowNum+1}"/>
            </apex:column>
             </apex:column>
            </apex:PageBlockTable>
        </apex:pageblocktable>
    <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!insertChild}"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
</apex:pageblock>
  </apex:form>
</apex:page>

Any Ideas ?
Best Answer chosen by Derek Dolan
Team NubesEliteTeam NubesElite
You cannot use <apex:column> directly in <apex:pageBlock> . Your code should be like this.
<apex:pageblock>
<apex:pageBlockTable value="{!childList}" var="int">
<apex:column headerValue="Pay Run">
<apex:inputField value="{!int.Pay_Run__c}"/>
</apex:column>
<apex:column breakBefore="true" colspan="2"/>
<apex:column headerValue="Lead Generator">
<apex:inputField value="{!int.Lead_Gen__c}"/>                  
</apex:column>
<apex:column headerValue="Pay Run">
<apex:inputField value="{!int.Pay_Run__c}"/>                                     
</apex:column>
</apex:pageBlockTable>
</apex:pageblock>

Thank You
www.nubeselite.com

Developement | Training | Consulting

Please Mark this as solution if your problem resolved.