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
Donald Reagan 3Donald Reagan 3 

VisualForce page selected picklist value is not passing value to controller class

I'm not able to pass the selected picklist value to the controller class. I'm using the picklist value to use it for my ORDER BY criteria in the SOQL
Here is my controller class code and Visual Force page.
public String pSortedBy { get; set; }

Public List<SelectOption> getSortOptions() {
		List<SelectOption> SortOptions = new List<SelectOption>();
		SortOptions.add(new SelectOption('Employee__r.Name','--Select print sort order--'));
		SortOptions.add(new SelectOption('Employee__r.Name','Employee Name'));
		SortOptions.add(new SelectOption('Employee__r.Local_Employee_Number__c','Local Employee Number'));
		
		return SortOptions;
	}

	Public List <Object> LoadEmployeeAttendanceToPrint() {
		string sQuery;
		sQuery = 'SELECT Employee__r.Name, Employee__r.Local_Employee_Number__c FROM Employee_Attendance_Detail__c ORDER BY ' ;
		
		sQuery += pSortedBy;
		 
		lstEmployeesAttendanceToPrint = new List<Employee_Attendance_Detail__c> ();
		lstEmployeesAttendanceToPrint = Database.query(sQuery);
		return lstEmployeesAttendanceToPrint;
		
		}
		
		
<apex:selectlist label="Select Print Order" value="{!pSortedBy}" multiselect="false" size="0" id="sortby" title="Select Print Order">
        <apex:selectoptions value="{!SortOptions}" />
</apex:selectlist>