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
Bareera NoorBareera Noor 

Visual force trailhead Challenge: Create & Use Custom Controllers

I need help with the fllowing code:
apex:page controller="ContactsListController">
    <apex:form >
        <apex:pageBlock title="Contacts List" id="contacts_list">
             
            <!-- Contacts List goes here -->
            <!-- Contacts List -->
<apex:pageBlockTable value="{! contacts }" var="ct">
 
    <apex:column value="{! ct.FirstName }"/>
    <apex:facet name="header">
        <apex:commandLink action="{! sortByFirstName }"
            reRender="contacts_list">First Name
        </apex:commandLink>
    </apex:facet>
    </apex:column>

    <apex:column value="{! ct.LastName }"/>
           <apex:facet name="header">
        <apex:commandLink action="{! sortByLastName }"
            reRender="contacts_list">Last Name
        </apex:commandLink>
    </apex:facet>
</apex:column>

    <apex:column value="{! ct.Title }"/>
    <apex:column value="{! ct.Email }"/>
     
     </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

I wrote this code but everytime I run this code it gives me a following error.

Error: ContactListController line 15, column 7: The element type "apex:pageblocktable" must be terminated by the matching end-tag "</apex:pageblocktable>"
Error: The element type "apex:pageblocktable" must be terminated by the matching end-tag "</apex:pageblocktable>".
Amit Chaudhary 8Amit Chaudhary 8
You need to remove / from below code
<apex:column value="{! ct.FirstName }"/>

Update your code like below
<apex:page controller="ContactsListController">
    <apex:form >
        <apex:pageBlock title="Contacts List" id="contacts_list">
		
			<apex:pageBlockTable value="{! contacts }" var="ct">
			
				<apex:column value="{! ct.FirstName }">
					<apex:facet name="header">
						<apex:commandLink action="{! sortByFirstName }"	reRender="contacts_list"> First Name </apex:commandLink>
					</apex:facet>
				</apex:column>

				<apex:column value="{! ct.LastName }">
					<apex:facet name="header">
						<apex:commandLink action="{! sortByLastName }" reRender="contacts_list"> Last Name </apex:commandLink>
					</apex:facet>
				</apex:column>

				<apex:column value="{! ct.Title }"/>
				<apex:column value="{! ct.Email }"/>
		 
			</apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Let us know if this will help you