You need to sign in to do that
Don't have an account?
laxman raj
AccWithAllContactsClass Compile Error: Invalid bind expression type of SOBJECT:Account for column of type String at line 11 column 60
<apex:page controller="AccWithAllContactsClass" >
<apex:form >
<apex:inputField value="{!acc.Name}"/>
<apex:commandButton value="ShowContacts" action="{!showcontacts}" reRender="out" status="mystatus"/>
<apex:actionStatus startText="please wait it is loading contacts.......">
<apex:facet name="stop">
<apex:outputPanel id="out">
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!conRecords}" var="c" >
<apex:column headerValue="Contacts">
{!c.name}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:facet>
</apex:actionStatus>
</apex:form>
</apex:page>
=====================================
public with sharing class AccWithAllContactsClass {
List<Account> lstaccount = new List<Account>();
List<contact> lstcontacts = new List<contact>();
public List<contact> getConRecords()
{
lstcontacts.clear();
accIds.clear();
lstaccount.clear();
system.debug('****AccNameTextValue is *****'+accName);
lstaccount=[select id,name from Account where name=:accName];
for(Integer i=0;i<lstaccount.size();i++)
{
accIds.add(lstaccount[i].Id);
}
lstcontacts =[select id,name,accountId from contact where accountid in : accIds];
system.debug('**** List of Contacts for Test is ***'+lstcontacts);
return lstcontacts;
}
set<string> accIds = new set<string>();
public pagereference showContacts() {
return null;
}
public Account accName { get; set; }
Public AccWithAllContactsClass()
{
}
}
<apex:form >
<apex:inputField value="{!acc.Name}"/>
<apex:commandButton value="ShowContacts" action="{!showcontacts}" reRender="out" status="mystatus"/>
<apex:actionStatus startText="please wait it is loading contacts.......">
<apex:facet name="stop">
<apex:outputPanel id="out">
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!conRecords}" var="c" >
<apex:column headerValue="Contacts">
{!c.name}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:facet>
</apex:actionStatus>
</apex:form>
</apex:page>
=====================================
public with sharing class AccWithAllContactsClass {
List<Account> lstaccount = new List<Account>();
List<contact> lstcontacts = new List<contact>();
public List<contact> getConRecords()
{
lstcontacts.clear();
accIds.clear();
lstaccount.clear();
system.debug('****AccNameTextValue is *****'+accName);
lstaccount=[select id,name from Account where name=:accName];
for(Integer i=0;i<lstaccount.size();i++)
{
accIds.add(lstaccount[i].Id);
}
lstcontacts =[select id,name,accountId from contact where accountid in : accIds];
system.debug('**** List of Contacts for Test is ***'+lstcontacts);
return lstcontacts;
}
set<string> accIds = new set<string>();
public pagereference showContacts() {
return null;
}
public Account accName { get; set; }
Public AccWithAllContactsClass()
{
}
}
Basically, either: