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
Carol WalgenwittCarol Walgenwitt 

Create Custom Controller Apex Class

I am following the exercise to Create Custom Controller Apex Class in Visualforce Basics -  I created the class and page ContactsListWithController - I added all the required code - I have a problem with the new action method - At the end the instructions say "Although the visual appearance remains the same, if you click the First Name and Last Name column headers now, they will change the sort order for the contacts list. Nice!" I do not get First Name or Last Name columns to click - I only get Last Name and when I click nothing happens - I am attaching screenshots of my code - I do not understand what I did wrong. Please check my code so can figure this out. Thank youscreen shot of my codescreen shot of my codescreen shot of my code
Mr SunnyMr Sunny
A custom controller is an Apex class that is used to implement the logic of visualforce page without leveraging the standard functionality. Custom Controller is defined as an Apex class that executes the logic of a page without using a regular controller. regards- ghd sports (https://ghdsportsapk.xyz/)
Open your developer console and go to File > New > Visualforce Page. You will also need to replace the markups in the editor with the following bit of code:
<apex:page controller= »ContactsListController »>
<apex:form>
<apex:pageBlock title= »Contacts List » id= »contacts_list »>
<!– Contacts List goes here –>
</apex:pageBlock>
</apex:form>
</apex:page>
get more info on below salesforce link
 https://trailhead.salesforce.com/content/learn/modules/visualforce_fundamentals/visualforce_custom_controllers
Suraj Tripathi 47Suraj Tripathi 47
Hi Carol,

A custom controller is just an Apex class, which you write yourself using the Developer Console. 
There are a lot of system and utility classes to help you write custom controller logic, but the only requirement for a class to be used as a custom controller is that it exists.
please go through this may be it will help you
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_custom.htm
and if you want to create the Sortable functionality by the click of First Name and Last Name then you can better understand from this :
https://help.salesforce.com/articleView?id=000328724&language=en_US&mode=1&type=1

if you have any query please comment.
---------------
If you find your Solution then mark this as the best answer to close this question. 

Thank you!
Regards,
Suraj Tripathi