Activity Forums Salesforce® Discussions pageblockSection is not rendered on click of commandButton Reply To: pageblockSection is not rendered on click of commandButton

  • Aman

    Member
    August 8, 2017 at 12:38 pm

    Hello Saloni,

    You can try  this :

    VF page;-

    <apex:page controller="SearchAccountCon" tabStyle="Account">
    <apex:form >

    <apex:inputText value="{!searchString}" />
    <apex:commandButton value="search" action="{!search}" rerender="pageblId"/>

    <apex:pageBlock >
    <apex:pageBlockTable value="{!acct}" var="acc" id ="pageblId">
    <apex:column headerValue="Acccount Name" >
    <apex:commandLink value="{!acc.name}" action="{!getCont}" reRender="LinkId" >
    <apex:param value="{!acc.Id}" name="LinkCont" assignTo="{!SearchId}"/>
    </apex:commandLink>
    </apex:column>
    <apex:column >
    <apex:pageBlockTable value="{!cont}" var="con" id="LinkId">
    <apex:column value="{!con.LastName}"/>
    <apex:column value="{!con.id}"/>
    </apex:pageBlockTable>
    </apex:column>

    </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

    Apex class :

    public class SearchAccountCon {
    public String SearchId{get;set;}
    public String searchString {get; set; }
    public List<Account> acct{get;set;}
    public List<contact> cont{get;set;}
    public void search(){

    acct= Database.query('Select Name, description From Account WHERE Name LIKE \'%'+searchString+'%\' Limit 100');
    cont = new List<contact>();

    }
    public void getCont(){
    cont=[select id,LastName,accountId from contact where accountID =:SearchId];
    }
    }