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
mbforcembforce 

Need help in writing Apex controller code for search functionality

Dear all,

Please help with the following

I am new to visualforce and Apex, need help in creating Apex controller for search button for following

 

I have created two object "Student" with fields (Name, Date of birth, Email, Phone, Course enrolled) and object "Course" with fields (Course Name, Fees, Intake, Start Date)

I have created a VF page where I will give course name and search and display students details who have enrolled for the course

 

created the simple VF page with following code, need Apex controller code for searching and displaying students details enrolled for that course.

 

<apex:page sidebar="false" showHeader="false" Controller="institutectrl">
      <apex:form >
                <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton value="Search"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="List of Students enrolled for a Course" columns="5">
               <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Course Name"/>
                    <apex:inputText id="account__name"/>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>  
    </apex:form>
 </apex:page>

 

 

Thanks,

Manish B. 

Abhi_TripathiAbhi_Tripathi

Hey Manish

 

Fisrt of all create some relation ship between these two object then go for SOQL and SOSL they are gonna help you for your search thing

AND you can go for this example too

 

http://abhithetechknight.blogspot.in/2013/07/dynamic-soql-brief-description.html

 

mbforcembforce

Thanks Abhi,

 

could you please give me apex code and VF page updates for above query

 

Thanks,

Manish B.