• swetha Rao 19
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
I need a picklist when a page is loaded and when a vales (Objects) selected from that picklist the records should display in picklist with a checkbox to delete selected records.
I have no error that not working? when I select course object from picklist the records are not displaying? Can any one tell me please..
<apex:page controller="DeleteRecords_wrapperClass">
  <apex:form >
    <apex:pageBlock >
      <apex:selectList value="{!SObjects}" size="1">
         <apex:selectOptions value="{!SelectObjects}"/>
      <apex:actionSupport event="OnChange" action="{!DisplayRecords}" reRender="Pgrf" />
      </apex:selectList>
    </apex:pageBlock> 
        <apex:pageBlock Id="Pgrf" rendered="{!Hide}">  
            <apex:pageBlockButtons >
                <apex:commandButton value="Delete" action="{!Remove}" />
            </apex:pageBlockButtons>
              <apex:pageBlockTable value="{!courseRecords}" var="c">
                  <apex:column > 
                     <apex:inputCheckbox value="{!c.isselected}" id="InputckId"/>
                  </apex:column>
                   <apex:column > 
                     {!c.cse.Name}
                  </apex:column>
                  <apex:column > 
                     {!c.cse.course_fee__c}
                  </apex:column>
              </apex:pageBlockTable>
          </apex:pageBlock>  
  </apex:form>
</apex:page>


public with sharing class DeleteRecords_wrapperClass {

    public String SObjects { get; set; }
    public Boolean Hide { get; set; }
    Public List<wrap> Wraplist {get; set;}
    
    public DeleteRecords_wrapperClass(){
        hide= false; 
    }
   
    public List<SelectOption> getSelectObjects() {
    
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('None','None'));
        options.add(new SelectOption('Course','Course'));
        options.add(new SelectOption('Student','Student'));
        return options;
        
    }
    
    public Void DisplayRecords() {
         Hide= True;
         system.debug('##SObjects '+SObjects);
         if(SObjects=='Course'){
         for(Course__c c3:[select id, Name,course_fee__c from Course__c]){
             system.debug('##c3 '+c3);    
             Wraplist.add(new wrap(c3));
             system.debug('##Wraplist '+Wraplist);
         
         }
     }
}
    
  
  //wrap w; 
  Public list<Course__c> selected {get; set;}

  public List<wrap> getcourseRecords(){
     
        Wraplist = new List<wrap>();
        for(Course__c c1:[select id, Name,course_fee__c from Course__c]){
          //  w = new Wrap(c1);
           // W.isselected = false;
           // w.cse=c1;
           Wraplist.add(new wrap(c1));
        }
    // Wraplist.add(w);
     Return Wraplist;
  }

  Public void Remove(){
         selected = new list<Course__c>();
        for(wrap c2:Wraplist){
        if(c2.isselected==true){
        selected.add(c2.cse);
        }
        
        }
        Delete selected;
  }
        

    Public class wrap{
    
        public Course__c cse {get; set;}
        public boolean isselected {get; set;}
        
    public wrap(course__c cc){
    
  
    
       cse=cc;
       isselected=False;
    
       }
        
        }
}
I want to display accounthistory or contacthistory records in a pageblock table when i select accounthistory or contactHistory from a picklist.
Example:: picklist values accountHistory , if i select this the account history records should display?How?..Can any one help me please..
 
I want to display accounthistory or contacthistory records in a pageblock table when i select accounthistory or contactHistory from a picklist.
Example:: picklist values accountHistory , if i select this the account history records should display?How?..Can any one help me please..