You need to sign in to do that
Don't have an account?
srikanth cheera 13
if i selected picklist only that record should be open
I have one vf dropdown list in that i have contact records
if i salected contact record only that record shoulb open?
if i salected contact record only that record shoulb open?
I trust you are doing very well.
Below is the sample code which I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Visualforce:
Controller:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in future.
Thanks and Regards,
Khan Anas
Kindly mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue. *(After you choose the best answer the question is marked as “resolved”)*
May the (Sales)force be with you :)
Happy Learning!
Regards,
Khan Anas
Below code can fullfill your requirements. Hope this will work for you.
VF page:
<apex:page controller="samplecontact" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:selectList value="{!numberLimit}" size="1" >
<apex:selectOptions value="{!records}" />
<apex:actionSupport action="{!showRecords}" event="onchange" reRender="pbt"/>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockTable value="{!acts}" var="a" id="pbt">
<apex:column value="{!a.name}" />
<apex:column value="{!a.id}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
controller:
public with sharing class samplecontact {
public integer numberLimit{get;set;}
public list<selectOption> records{get;set;}
public list<Contact> actss{get;set;}
public samplecontact(){
actss=new List<Contact>();
records=new List<selectOption>();
records.add(new selectoption('10','10'));
records.add(new selectoption('20','20'));
numberLimit=10;
}
public List<Contact> getActs(){
actss=[select name,id from Contact limit :numberLimit];
return actss;
}
public pageReference showRecords(){
return null;
}
}
Please mark this as best answer if this solves your problem.
Thank you
Ajay Dubedi