You need to sign in to do that
Don't have an account?
sonam
Values of custom object arent displayed in The Vf page
Accounts is a custom object.i have to retrieve the account type on the basis of Name.
I am able to retrieve the id and i'm getting account type in debug. But, it isnt displayed in the VF page.
Please have a look at the code..
Given below is the code of Class and VF page
<apex:page controller="SearchByName"> <apex:form > <apex:outputLabel style="font-weight:bold;" value="Search By Name" ></apex:outputLabel> <apex:inputText value="{!textData}"/> <apex:commandButton action="{!search}" value="Search" id="search" rerender="out, msgs" status="status"/> </apex:form> <!------Doesnt print the first name and account type-------> <apex:pageBlock > <apex:pageBlockTable value="{!Accounts}" var="c" > <apex:column > <apex:facet name="header">First Name</apex:facet> <apex:outputField value="{!c.First_Name__c}" /> </apex:column> <apex:column > <apex:facet name="header">Account Type</apex:facet> <apex:outputField value="{!c.Account_Type__c}" /> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <!------------- Getting the value of var "c"------------> <apex:outputPanel id="out"> <apex:actionstatus id="status" startText="searching..."> <apex:facet name="stop"> <apex:outputPanel > <apex:dataList value="{!Accounts}" var="c">a:{!c}</apex:dataList> </apex:outputPanel> </apex:facet> </apex:actionstatus> </apex:outputPanel> </apex:page>
public class SearchByName { List<Account__c> Accounts; private String textdata = null; public String getTextData() { return textdata; } public void setTextData(String data) { textdata = data; } public void search(){ Accounts = Database.query('SELECT First_Name__c,Account_Type__c FROM Account__c where First_Name__c = :textdata'); system.debug('Accounts>>>>'+Accounts); } public List<Account__c> getAccounts() { return Accounts; } }
You need rerender your Pageblock where you print name and account type. Put page block in an output panel and rerender it in search button. Below code should work.
All Answers
You need rerender your Pageblock where you print name and account type. Put page block in an output panel and rerender it in search button. Below code should work.
Thank You so much...It worked.. :)