Tuesday 17 September 2013

CUSTOM BUTTONS

CUSTOM BUTTONS IN  Particular RECORD DETAILPAGE  :
Below show Detail is my custom Button
Note : Detail Page link is same as Detail page Button..
Difference is  it is Button & link

Go to object detail pageà Custom Buttons and Links à newà

Select Radio Button ( Detail Page Button).

Select Visualforce pageà below displays content of standard VF page(use standard controller only). Then save

Then go to PageLayout Drag and drop the custom Button  then Save it.

Create one record

 





When we click on Show Detail Button it will display Below VF page:

<apex:page standardController="test__c" extensions="selectDetail">
 <apex:form >
   <apex:pageBlock mode="inlineEdit" >
  <apex:pageblockTable value="{!ll}" var="a">
    <apex:column value="{!a.name}"/>
    <apex:column value="{!a.Email__c}"/>
    <apex:column value="{!a.Gender__c}"/>
    <apex:column value="{!a.Phone__c}"/>
    <apex:column value="{!a.field1__c}"/>
    <apex:column value="{!a.field2__c}"/>
    <apex:column value="{!a.field3__c}"/>
    <apex:column value="{!a.field4__c}"/>
   </apex:pageblockTable>
   <apex:commandButton value="Save" action="{!mysave}"/>
   </apex:pageBlock>
  </apex:form>

</apex:page>


public with sharing class selectDetail {
    public selectDetail(ApexPages.StandardController controller) {
ll = [select id,name,Email__c,Gender__c,Phone__c,field1__c,field2__c,field3__c,field4__c from test__c  where id=:apexpages.currentpage().getparameters().get('id')];
 }
   public Pagereference mysave(){
    update ll;  
   pagereference pp= new pagereference('/'+ll.id);
   return pp;
   }
public test__c ll{get;set;}
}
Note: after save it, it will go to detail Page.

CUSTOM BUTTONS IN   RECORDS DETAILPAGE  :

Go to object detail pageà Custom Buttons and Links à newà

Fill the details:

Select Radio Button ( List Button).

Select Visualforce pageà below displays content of standard VF page(use standard controller only). Then save

Then go to Search Layout  click on edit Students(sobject) List Viewà

Add Button to right Save it

 

Click Sobject Records and click GO

 

 

 






Click on GO Button: display below
After Click on Details MS display as below:
<apex:page standardController="Student__c" recordSetVar="Rec" extensions="select1">
  <apex:form >
   <apex:pageBlock >
    <apex:dataTable value="{!rec}" var="a">
    <apex:column value="{!a.name}"/>
    <apex:column value="{!a.DOB__c}"/>
    <apex:column value="{!a.Email__c}"/>
    <apex:column value="{!a.Teacher_No__c}"/>
    </apex:dataTable>
  
   </apex:pageBlock>
  </apex:form>
</apex:page>
public with sharing class select1 {
public List<student__c> ll{get;set;}
    public select1(ApexPages.StandardSetController controller) {
       ll=controller.getSelected();
    }

}


No comments:

Post a Comment