• prashanthreddypalnati
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
public class AllAccounts
{
    public list<Account> acc{get;set;}
    public integer selected{get;set;}
    public list<InnerClass> allaccWrapper{get;set;}
    public boolean unck;
    public AllAccounts()
    {
        unck = false;
        allaccWrapper = new list<InnerClass>();
        acc = [select id,name from Account];
        for(integer i = 0;i<acc.size();i++)
        {
           InnerClass innclas = new InnerClass(acc[i],unck);
           allaccWrapper.add(innclas);
        }
    }
    
    
    public void chckcount()
    {
        selected = 0;
        for(integer i =0;i<allaccWrapper.size();i++)
        {
            if(allaccWrapper[i].tounchk == true)
            {
                selected = selected +1;
            }
        }
    }
    
    
    public void SelectAll()
    {
        for(integer i =0;i<allaccWrapper.size();i++)
        {
            allaccWrapper[i].tounchk  = true;
        }
    }
    
    public class InnerClass
    {
        public account toacc{get;set;}
        public boolean tounchk{get;set;}
        
        public InnerClass(Account fromacc,boolean fromunchk)
        {
             toacc = fromacc;
             tounchk = fromunchk;
        }
    }
}


<apex:page controller="AllAccounts">
  <apex:form>
      <apex:pageBlock>
          <apex:pageBlockTable value="{!allaccWrapper}" var="allAccounts">
              <apex:column headerValue="Allchk">
                 <apex:inputCheckbox value="{!allAccounts.tounchk}"/>
               </apex:column>
              <apex:column headerValue="ID">
                  <apex:outputText>{!allAccounts.toacc.id}</apex:outputText>
               </apex:column>
                <apex:column headerValue="Name">
                  <apex:outputText>{!allAccounts.toacc.Name}</apex:outputText>
               </apex:column>
          </apex:pageBlockTable>
          HAI SELCTED COUNT IS HERE==><apex:outputText>{!selected}</apex:outputText>
          <apex:commandButton value="selectedcount" action="{!chckcount}"/>
           <apex:commandButton value="selectAll" action="{!SelectAll}"/>
      </apex:pageBlock>
  </apex:form>-
</apex:page>

 way the code execut........from where to where.........help me out please...........

public class AllAccounts
{
    public list<Account> acc{get;set;}
    public integer selected{get;set;}
    public list<InnerClass> allaccWrapper{get;set;}
    public boolean unck;
    public AllAccounts()
    {
        unck = false;
        allaccWrapper = new list<InnerClass>();
        acc = [select id,name from Account];
        for(integer i = 0;i<acc.size();i++)
        {
           InnerClass innclas = new InnerClass(acc[i],unck);
           allaccWrapper.add(innclas);
        }
    }
    
    
    public void chckcount()
    {
        selected = 0;
        for(integer i =0;i<allaccWrapper.size();i++)
        {
            if(allaccWrapper[i].tounchk == true)
            {
                selected = selected +1;
            }
        }
    }
    
    
    public void SelectAll()
    {
        for(integer i =0;i<allaccWrapper.size();i++)
        {
            allaccWrapper[i].tounchk  = true;
        }
    }
    
    public class InnerClass
    {
        public account toacc{get;set;}
        public boolean tounchk{get;set;}
        
        public InnerClass(Account fromacc,boolean fromunchk)
        {
             toacc = fromacc;
             tounchk = fromunchk;
        }
    }
}


<apex:page controller="AllAccounts">
  <apex:form>
      <apex:pageBlock>
          <apex:pageBlockTable value="{!allaccWrapper}" var="allAccounts">
              <apex:column headerValue="Allchk">
                 <apex:inputCheckbox value="{!allAccounts.tounchk}"/>
               </apex:column>
              <apex:column headerValue="ID">
                  <apex:outputText>{!allAccounts.toacc.id}</apex:outputText>
               </apex:column>
                <apex:column headerValue="Name">
                  <apex:outputText>{!allAccounts.toacc.Name}</apex:outputText>
               </apex:column>
          </apex:pageBlockTable>
          HAI SELCTED COUNT IS HERE==><apex:outputText>{!selected}</apex:outputText>
          <apex:commandButton value="selectedcount" action="{!chckcount}"/>
           <apex:commandButton value="selectAll" action="{!SelectAll}"/>
      </apex:pageBlock>
  </apex:form>-
</apex:page>

 way the code execut........from where to where.........help me out please...........

When I run the following code i got error like 

 

"controllercls2 Compile Error: Illegal assignment from LIST<Account> to LIST<Account> at line 9 column5" 

 

And

 

When i insert out side of constructor " lst=[select id,name,phone from Account]; "

I got Error lik this

 

 

"Error: controllercls2 Compile Error: unexpected token: '=' at line 11 column 3 "

 

 

<apex:page controller="controllercls2" id="page">
<apex:form id="form">

<apex:outputlabel >Enter Text to search</apex:outputlabel>
<apex:inputtext />
<apex:commandButton value="Search" />
<apex:pageblock id="pb">
<apex:pageblocktable value="{!lst}" var="c">
<apex:column value="{!c.name}"/>
<apex:column value="{!c.phone}"/>
</apex:pageblocktable>


</apex:pageblock>
</apex:form>
</apex:page>

 

------------------------------------------

 

public with sharing class controllercls2 {

public List<Account> lst { get; set; }


public controllercls2()
{

lst=[select id,name,phone from Account];
}


}