+ Start a Discussion
lucky25lucky25 

please write the custem controller for this visualforce page

<apex:page Controller="con2" >
<apex:form >
<apex:pageMessages />
<apex:pageBlock title="Book data to Store" mode="edit">


<!--This is the first section-->
<apex:pageBlockSection Title="Book Information" columns="1">

<apex:pageBlockSectionItem >
<apex:outputText value="BookName"/>
<apex:inputtext value="{!bk.Name}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputText value="Authorname"/>
<apex:inputText value="{!bk.Authorname__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputText value="price"/>
<apex:inputText value="{!bk.price__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputText value="EmailId"/>
<apex:inputText value="{!bk.Emailid__c}"/>
</apex:pageBlockSectionItem>
</apex:pageblocksection>

<apex:pageBlockButtons location="top">

<apex:commandButton value="save" action="{!save}" />
<apex:commandButton value="Reset" action="{!Reset}" />

</apex:pageBlockButtons>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Delete" action="{!delete_selected}" />
<apex:commandButton value="Edit" action="{!Edit}" />
<apex:commandButton value="sendmail" action="{!sendMail}" />
</apex:pageBlockButtons>

<apex:pageBlockTable value="{!bks}" var="b" >
<apex:column headerValue="Action">
<apex:inputCheckbox value="{!b.action__c}" />
</apex:column>
<apex:column value="{!b.Authorname__c}"/>
<apex:column value="{!b.Name}"/>
<apex:column value="{!b.price__c}"/>
<apex:column value="{!b.Emailid__c}"/>
</apex:pageBlockTable>

</apex:pageBlock>
</apex:form>
</apex:page>

HariDineshHariDinesh

Hi,

Custom controller Purpose is, if you want to override the existing functionality, any custom navigations, to implement own custom logic, any callouts..... like this

By Def:
A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.

so write custom controller if you want to implement your own logic.
hope you understand

Follow below links:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_def.htm
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller.htm
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_custom.htm
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_extension.htm